Joh*_*ith 2 iphone cocoa-touch uitableview
我有时重新加载表数据,我需要重绘表,以便我再次看到第一行的数据.我现在做的是以下内容:
NSIndexPath *ip = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView selectRowAtIndexPath:ip animated:NO scrollPosition:UITableViewScrollPositionTop ];
[self.tableView deselectRowAtIndexPath:ip animated:NO];
Run Code Online (Sandbox Code Playgroud)
这并不理想,因为当选择第0行并立即取消选择时会出现恼人的闪光.
我怎样才能解决这个问题?
Jac*_*kin 13
您可以使用UITableView的scrollToRowAtIndexPath:atScrollPosition:animated:方法.
[tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3797 次 |
| 最近记录: |