[英]Is it possible to reload UITableView except particular rows of section?
[英]How reload particular section in UITableview?
当我尝试重新加载特定的部分时,表格视图会自动向上方滚动,而我不明白发生了什么?我使用了下面的代码。
[_moviesDetailTableview beginUpdates];
[_moviesDetailTableview reloadSections:[NSIndexSet indexSetWithIndex:1]withRowAnimation:UITableViewRowAnimationNone];
[_moviesDetailTableview endUpdates];
并且您可以存储表视图的content offset
。 并可以做类似的事情,
GPoint contentOffset = _moviesDetailTableview.contentOffset;
[_moviesDetailTableview beginUpdates];
[_moviesDetailTableview reloadSections:[NSIndexSet indexSetWithIndex:1]withRowAnimation:UITableViewRowAnimationNone];
[_moviesDetailTableview endUpdates];
[_moviesDetailTableview layoutIfNeeded];
[_moviesDetailTableview setContentOffset:contentOffset];
试试这个代码,
[self.tableView reloadSection:0 withRowAnimation:UITableViewRowAnimationNone];
- (void) reloadSection:(NSInteger)section withRowAnimation:(UITableViewRowAnimation)rowAnimation {
NSRange range = NSMakeRange(section, 1);
NSIndexSet *sectionToReload = [NSIndexSet indexSetWithIndexesInRange:range];
[self reloadSections:sectionToReload withRowAnimation:rowAnimation];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.