简体   繁体   中英

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?

I solved my problem implementing the method

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

even if I'm using a static table view.

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];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM