Reputation: 3159
I have a subclassed UTableViewCell that is laid out in the picture below. Everything is wired up with AutoLayout constraints (although still work in progress).
Basically, this custom cell is working as expected. However, I would like to use this same cell, but without the UIImageView for some indexPath.rows.
I'm trying something like below:
cell = [tableView dequeueReusableCellWithIdentifier:@"BaseDiaryCell"];
[cell.photoImageView removeFromSuperview];
and hoped that the cell should shrink because I removed the UIImageView from the cell, but it stays the same size with a gap between the "MainText" UILabel and the 3 UIButton at the bottom.
Is what I'm doing possible? Is there another way to remove the UIImageView and have the cell automagically shrink down to reflect the changed layout?
Thank you!
Upvotes: 3
Views: 207
Reputation: 1819
No. Thats not possible. Auto layout constraints are only used to detect the Rect of the object and animation context.
I think the best possible way is to create a new cell with no ImageView, so there will be two cells, one with the image view and other without. You can use cell identifiers to distinguish between them.
You will also need to use login in height for row
method in your data source.
Upvotes: 0