感觉这个问题是由于
[self.collectionView reloadData];
[self.collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0] atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:NO];
首先重载collection view,可能该步骤还未执行完,又去执行scrollviewto某个index,导致冲突。
我这里先暂时修改为,直接更改UICollectionView的contentOffset
self.collectionView.contentOffset = CGPointZero;
[self.collectionView reloadData];
然后目前看还未再次出现该bug。
stack overflow上面的一些链接。
http://stackoverflow.com/questions/19008307/uicollectionview-interactive-layout-transition-using-ios-7-apis?rq=1
http://stackoverflow.com/questions/26947366/scrolltoitematindexpath-destroys-uicollectionviewcell-layout?lq=1
http://stackoverflow.com/questions/19816184/uicollectionview-scrolltoitematindexpath