Skip to content

Commit e882981

Browse files
Tyler FoxTyler Fox
authored andcommitted
Add code stub to fix constraint exception that may occur
1 parent 3ab8ca2 commit e882981

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

TableViewCellWithAutoLayout/TableViewController/RJTableViewCell.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ - (void)updateConstraints
7474
return;
7575
}
7676

77+
// Note: if the constraints you add below require a larger cell size than the current size (which is likely to be the default size {320, 44}), you'll get an exception.
78+
// As a fix, you can temporarily increase the size of the cell's contentView so that this does not occur using code similar to the line below.
79+
// See here for further discussion: https://github.com/Alex311/TableCellWithAutoLayout/commit/bde387b27e33605eeac3465475d2f2ff9775f163#commitcomment-4633188
80+
// self.contentView.bounds = CGRectMake(0.0f, 0.0f, 99999.0f, 99999.0f);
81+
7782
[self.titleLabel setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical];
7883
[self.titleLabel autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:kLabelVerticalInsets];
7984
[self.titleLabel autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:kLabelHorizontalInsets];

0 commit comments

Comments
 (0)