Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is a subclass, based on other answers ideas, I'm going to base my custom cells on:</p> <pre><code>@interface FixedTableViewCell () - (void)initFixedTableViewCell; @end @interface FixedTableViewCell : UITableViewCell @end @implementation FixedTableViewCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if (nil != (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) { [self initFixedTableViewCell]; } return self; } - (void)awakeFromNib { [super awakeFromNib]; [self initFixedTableViewCell]; } - (void)initFixedTableViewCell { for (NSInteger i = self.constraints.count - 1; i &gt;= 0; i--) { NSLayoutConstraint *constraint = [self.constraints objectAtIndex:i]; id firstItem = constraint.firstItem; id secondItem = constraint.secondItem; BOOL shouldMoveToContentView = YES; if ([firstItem isDescendantOfView:self.contentView]) { if (NO == [secondItem isDescendantOfView:self.contentView]) { secondItem = self.contentView; } } else if ([secondItem isDescendantOfView:self.contentView]) { if (NO == [firstItem isDescendantOfView:self.contentView]) { firstItem = self.contentView; } } else { shouldMoveToContentView = NO; } if (shouldMoveToContentView) { [self removeConstraint:constraint]; NSLayoutConstraint *contentViewConstraint = [NSLayoutConstraint constraintWithItem:firstItem attribute:constraint.firstAttribute relatedBy:constraint.relation toItem:secondItem attribute:constraint.secondAttribute multiplier:constraint.multiplier constant:constraint.constant]; [self.contentView addConstraint:contentViewConstraint]; } } } @end </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload