Luca Torella
Luca Torella

Reputation: 8214

iOS static table view not so static

I'm developing a static grouped table view with storyboard. Anyway, sometimes I'd like not to display some of the rows. As long as the rows I want to hide are in the middle, I can set the height of that specific cell to 0 and the trick works :)

Anyway, when I want to hide the last cell of a group (I'm using a grouped table view), my trick obviously does not work. That's because the previous cell won't get the round corners typical of the last cell. Is there another trick that can help me with this issue?

Upvotes: 0

Views: 140

Answers (2)

Luca Torella
Luca Torella

Reputation: 8214

I solved my problem implementing the method

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

even if I'm using a static table view.

Upvotes: 1

Tarek
Tarek

Reputation: 2392

The proper way to remove a cell from a table view after it has been rendered is to use the UITableView method called deleteRowsAtIndexPaths:withRowAnimation: . Here is a code sample:

[tableView deleteRowsAtIndexPaths:@[myCellIndexPath] withRowAnimation:UITableViewRowAnimationAutomatic];

Upvotes: 0

Related Questions