This should be easy, but I’m having trouble.
I have a static UITableView with a cell that I would like to remove programmatically if it’s not needed.
I have a IBOutlet for it
IBOutlet UITableViewCell * cell15;
And I can remove it by calling
cell15.hidden = true;
This hides it, but leaves a blank space where the cell used to be and I can’t get rid of it.
Perhaps a hack would be to change the height of it to 0?
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:indexPath
{
//what would I put here?
}
Thanks so much!
You can’t really deal with this in the datasource since with static tables you don’t even implement the datasource methods. The height is the way to go.
Try this:
Update
It appears that, under autolayout, this may not be the best solution. There is an alternative answer here which may help.