相关疑难解决方法(0)

如何判断UITableView何时完成了ReloadData?

我想在完成表演后滚动到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是对的)

objective-c uitableview reloaddata

167
推荐指数
8
解决办法
11万
查看次数

如何使用FlowLayout确定UICollectionView的高度

UICollectionView有一个UICollectionViewFlowLayout,我想计算它的内容大小(intrinsicContentSize通过AutoLayout调整其高度所需的返回).

问题是:即使我对所有单元都有一个固定且相等的高度,我也不知道我有多少"行"/行UICollectionView.我也无法通过数据源中的项目数来确定计数,因为表示数据项的单元格的宽度不同,因此我在一行中的项目数量也不同UICollectionView.

由于我在官方文档中找不到关于此主题的任何提示,谷歌搜索没有给我带来任何进一步的帮助和想法将非常感激.

height ios autolayout uicollectionview

111
推荐指数
8
解决办法
7万
查看次数

我如何知道UICollectionView已完全加载?

每当完全加载UICollectionView时,我必须做一些操作,即那时应该调用所有UICollectionView的数据源/布局方法.我怎么知道?是否有任何委托方法来了解UICollectionView加载状态?

delegates reload uicollectionview

90
推荐指数
8
解决办法
6万
查看次数