UILabel auto lower pixels

I built a UITableCellView from xib. This xib uses autolayout and two UILabel associated with a superview and with a vertical restriction.

Unfortunately, this is the reduction of pixels (pixels) at the bottom of the UILabel : enter image description here

What am I missing?

UPD. Xcode gives me an error: Set vertical compression resistance priority to 749 . If I play with the priority of resistance to compression, I get the first inscription.

+7
ios uilabel autolayout pixels
source share
1 answer

Set the priority of the vertical spacing between two labels lower than the vertical spacing between the labels and the top and bottom of the view. Also in your delegate override

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath

and

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

which will return a height that will correspond to the restrictions and heights of the labels. By default, I think you get 44 pixels, so you can get a higher cell by overriding them. Alternatively, you can set the cell height in IB if you use storyboards or Nibs.

+2
source share

All Articles