您的位置:首页 > 移动开发 > IOS开发

iOS tableView的增加,删除,刷新,更新的方法

2015-10-08 00:00 525 查看
摘要: iOS tableView的增加,删除,刷新,更新的方法

NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];

//插入某一行

[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:index] withRowAnimation:

UITableViewRowAnimationNone];

//插入某一分区

[self.tableView insertSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationNone];

//删除某一行

[self.tableView removeRowsAtIndexPaths:[NSArray arrayWithObject:index] withRowAnimation:UITableViewRowAnimationNone];

//删除某一分区

[self.tableView removeSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationNone];

//刷新某一行

[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:index] withRowAnimation:UITableViewRowAnimationNone];

//刷新某一分区

[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationNone];

//更新某一行

[self.tableView updateRowsAtIndexPaths:[NSArray arrayWithObject:index] withRowAnimation:UITableViewRowAnimationNone];

//更新某一分区

[self.tableView updateSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationNone];

//刷新整个tableview

[self.tableView reloadData];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息