7
votes

I constructing UITableCellView from xib. This xib uses autolayout and two UILabels connected to superview and have vertical constraint.

Unfortunately it is cutting pixel(s) at the bottom of UILabel: enter image description here

What do I missing?

UPD. Xcode is giving me error: Set vertical compression resistance priority to 749. If I play with compression resistance priority I get first label cut.

1

1 Answers

2
votes

Set the priority on the vertical spacing constraint between the two labels to be lower than the vertical spacing constraint between the labels and the top and bottom of the view. Alternatively, in your delegate, override

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

and

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

that will return a height that will accommodate the constraints and label heights. By default I believe you get 44 pixels, so you can get a taller cell by overriding these. Also, you can set the cell height in IB if you're using Storyboards or Nibs.