I want to remove a IBOutlet UIimage from certain table cells:
I have a custom table cell comprising an image, a label, a subtitle…
cellIcon, cellHead, cellStandfirst
Some cells wont have an image, so I want the label and subtitle to extend backwards to fill the space left by the image (Just as a standard UITable behaves if it doesn’t have a custom cell class)
Currently I’m calling
[cell shortCell:cell.bounds.size.width];
from the tableViewController, which calls
- (void)shortCell:(float)myfloat; {
[cellHead setFrame:CGRectMake(
CELL_CONTENT_MARGIN,
3.0f,
myfloat - (CELL_CONTENT_MARGIN * 2),
24.0f)];
[cellStandfirst setFrame:CGRectMake(
CELL_CONTENT_MARGIN,
25.0f,
myfloat - (CELL_CONTENT_MARGIN * 2),
34.0f)];
}
which works fine but it strikes me that the default table view must remove the image rather than resize the labels.
I tried putting variants of
[cellIcon removeFromSuperview];
in the cell class, and
[cell.cellIcon remove];
in the tableview controller but can’t get anything to work
Is it possible to remove a table cell image from certain cells so the labels resize automatically?
Used this code
Then in the cell class