我试图通过搜索列表找到项目索引.有谁知道怎么做?
我看到有item index,list但我想要像python的东西list.StartIndex.
我想在完成表演后滚动到UITableView的底部 [self.tableView reloadData]
我原本有
[self.tableView reloadData]
NSIndexPath* indexPath = [NSIndexPath indexPathForRow: ([self.tableView numberOfRowsInSection:([self.tableView numberOfSections]-1)]-1) inSection: ([self.tableView numberOfSections]-1)];
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
Run Code Online (Sandbox Code Playgroud)
但后来我读了reloadData是异步的,所以滚动不因为发生self.tableView,[self.tableView numberOfSections]并且[self.tableView numberOfRowsinSection都是0.
谢谢!
有什么奇怪的是我正在使用:
[self.tableView reloadData];
NSLog(@"Number of Sections %d", [self.tableView numberOfSections]);
NSLog(@"Number of Rows %d", [self.tableView numberOfRowsInSection:([self.tableView numberOfSections]-1)]-1);
Run Code Online (Sandbox Code Playgroud)
在控制台中它返回Sections = 1,Row = -1;
当我完成相同的NSLogs时,cellForRowAtIndexPath我得到Sections = 1和Row = 8; (8是对的)
我想在加载完成后更改表的偏移量,并且该偏移量取决于表上加载的单元格数.
是否可以通过SDK知道uitableview加载何时完成?我在委托和数据源协议上都没有看到任何内容.
我不能使用数据源的计数,因为只加载可见单元格.
我在我的应用程序中遇到问题 - 您可以发布和编辑您喜欢的地方.发布帖子或编辑特定帖子(UITableViewCell)后,UITableview会重新加载.
我的问题是:UITableview重新加载后滚动到顶部.但这不是我想要的.我希望我的观点留在我所在的单元格/视图上.但我不知道如何管理.
你可以帮帮我吗?
reloaddata ×2
swift ×2
uitableview ×2
arrays ×1
cell ×1
ios ×1
iphone ×1
objective-c ×1
tableview ×1