Reputation: 3444
I am new to iOS app development. i have created the view like below.
and i am reusing the same view in other screen. so that screen dont need the "ss" Initials. so i have hidden than programmatically.like below.
here i am facing the unwanted spacing issue on second screen.
What i want is, when the "SS" initials hidden, the name and subject need to come to the left aligned. i don't know what content need to give for google it. guys please give some keyword to find solution or please give some solution to it.
Upvotes: 1
Views: 154
Reputation: 2037
If you do not want to use stackViews
you can physically move the label by "animating" it or moving its frame.
self.labelToMove.frame = CGRect(x: x, y: y, width: width, height: height)
Call this line with the desired position wherever you programatically "hide" the image view.
you can move it back by doing the same thing when you programmatically "unhide" the initials image
Upvotes: 2
Reputation: 5098
You can use UIStackView
for this problem.
let us call everything but the UIImageView
is the RHS and the UIImageView
is the LHS
place them in a vertical UIStackView
and when you hide the UIImageView
it should automatically remove that spacing and shift the content to fill the view.
If you haven't seen them yet I recommend this tutorial.
Upvotes: 3