UITableView刷新各部分

来源:互联网 发布:营养分析软件 编辑:程序博客网 时间:2024/05/16 01:13

UITableView中刷新Cell

//局部section刷新NSIndexSet *set = [[NSIndexSet alloc] initWithIndex:1]; //刷新第二个section[self.tableView reloadSections:set withRowAnimation:UITableViewRowAnimationAutomatic];//枚举类型//局部cell刷新NSIndexPath *row=[NSIndexPath indexPathForRow:1 inSection:0];//刷新第一个section的第二行[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:row,nil] withRowAnimation:UITableViewRowAnimationMiddle];

有时可能也会遇到刷新UITableView的表头,区头,区脚,但是[UItableView reloadData]是只管刷新Cell内容的,这样就尴尬了。

对于表头来说,刷新的做法就是把表头去掉在重新按上去,(注意:这里不能使用懒加载的方式创建表头,要不然去掉表头并没有立即释放表头,所以在创建时是不会创建的。)

对于区头区脚来说,做好还是只去改变里面UILabel啊,UIImageView的图片等这种做法。

0 0
原创粉丝点击