调用方式 – (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)部分无需重新加载
我已经做好了:
[tableView setNeedsLayout]
和[tableView setNeedsDisplay]
,但是这不会调用该委托。 有没有办法重新布局tableView而不重新加载数据(即:调用reloadData)
尝试:
[tableView beginUpdates]; //do stuff... [tableView endUpdates];
你到底有什么需要。然后我们才能帮助你。
您是否已执行以下步骤来启动UITableView的委托
1.include UITableViewDelegate和UITableViewDataSource 2.将tableViewDelegate和datasource链接到Interface Builder中的Files Owner
如果你想调用你的tableview委托方法的意思,
[table reloadData]
想知道您是否需要进一步澄清
以下是可用于仅影响表的一部分的方法列表。
插入,删除和移动行和节:
- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; - (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation; - (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; - (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation; - (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath; - (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection;
重装:
- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; - (void)reloadSectionIndexTitles; - (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation;
别忘了把你的代码放进去
[tableView beginUpdates]; //do stuff... [tableView endUpdates];
阻止@Wise Shepherd建议避免tableView和index out of bounds
exception的失禁状态。