UITableView和UICollectionView-rel

2016-08-18  本文已影响1887人  lance017

有些时候,需要我们先刷新数据源,在设置ContentOffset的位置,但是可能会出现设置的ContentOffset不符的情况,以下为解决的方法:

[self.collectionView reloadData];

[self.collectionView layoutIfNeeded]; 

[self.collectionView setContentOffset:CGPointMake(Width, 0)];

[stackoverflow][1]
[1]: http://stackoverflow.com/questions/8640409/how-to-keep-uitableview-contentoffset-after-calling-reloaddata

上一篇 下一篇

猜你喜欢

热点阅读