Reputation: 153
I am planning to use two UILabels of equal width side by side in UITableViewCell. Though, the content inside the each label would be dynamic in length and hence UILable's height would be different even though contained inside same table cell.I have used Auto-Layout under XCode 6.0. I am able to achieve everything through auto-layout constraints but only hurdle is the additional padding existing on UILable as shown in reference Image. I just want the labels to be occupying exact fitting size and not with the additional padding as seen in refernce Image
Here are constraints applied:
Upvotes: 0
Views: 949
Reputation: 2417
There are two vertical constraints on each label. Now considering the scenario that you need your label to be top-aligned, you can keep the top constraint as it is. Change the bottom constraint
to flexible values i.e. >=8
. If you want it to be bottom aligned then you need to loosen the top constraint
.
Upvotes: 1
Reputation: 2367
There you have it. Your labels have constraints to the top and bottom of the superview. So when the superview changes its heights, the labels increase their height too to match the constraints.
Upvotes: 0