File tree Expand file tree Collapse file tree
TableViewCellWithAutoLayout/TableViewController Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,8 +84,14 @@ - (void)updateConstraints
8484 [self .titleLabel autoPinEdgeToSuperviewEdge: ALEdgeLeading withInset: kLabelHorizontalInsets ];
8585 [self .titleLabel autoPinEdgeToSuperviewEdge: ALEdgeTrailing withInset: kLabelHorizontalInsets ];
8686
87+ // This is the constraint that connects the title and body labels. It is a "greater than or equal" inequality so that if the row height is
88+ // slightly larger than what is actually required to fit the cell's subviews, the extra space will go here. (This is the case on iOS 7
89+ // where the cell separator is only 0.5 points tall, but in the tableView:heightForRowAtIndexPath: method of the view controller, we add
90+ // a full 1.0 point in extra height to account for it, which results in 0.5 points extra space in the cell.)
91+ // See https://github.com/smileyborg/TableViewCellWithAutoLayout/issues/3 for more info.
92+ [self .bodyLabel autoPinEdge: ALEdgeTop toEdge: ALEdgeBottom ofView: self .titleLabel withOffset: kLabelVerticalInsets relation: NSLayoutRelationGreaterThanOrEqual];
93+
8794 [self .bodyLabel setContentCompressionResistancePriority: UILayoutPriorityRequired forAxis: UILayoutConstraintAxisVertical];
88- [self .bodyLabel autoPinEdge: ALEdgeTop toEdge: ALEdgeBottom ofView: self .titleLabel withOffset: kLabelVerticalInsets ];
8995 [self .bodyLabel autoPinEdgeToSuperviewEdge: ALEdgeLeading withInset: kLabelHorizontalInsets ];
9096 [self .bodyLabel autoPinEdgeToSuperviewEdge: ALEdgeTrailing withInset: kLabelHorizontalInsets ];
9197 [self .bodyLabel autoPinEdgeToSuperviewEdge: ALEdgeBottom withInset: kLabelVerticalInsets ];
You can’t perform that action at this time.
0 commit comments