【发布时间】:2014-09-14 00:38:16
【问题描述】:
我有一个应用程序,其中包含用户可以阅读的文章列表。一旦用户点击了一篇文章,我想将它呈现给用户,然后将代表文章的单元格移动到不同的集合视图部分,代表已阅读文章:
Unread | Read
0 0 0 0 | X X
下面的代码会导致所有单元格重新加载,看起来所有单元格都以背景颜色闪烁。 有没有办法让我将一个单元格从集合视图的一个部分移动到另一个部分?
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
if([collectionView isEqual:self.largeCollectionView])
{
//position the tapped image at the end and animate reload
UIImage* image = largeImages[indexPath.row];
[largeImages removeObjectAtIndex:indexPath.row];
[largeImages addObject:image];
}
[collectionView performBatchUpdates:^{
[collectionView reloadSections:[NSIndexSet indexSetWithIndex:0]];
} completion:^(BOOL finished) {
}];
}
【问题讨论】:
-
您是否成功找到了将项目移动到带有动画的另一个部分的方法?
标签: ios objective-c animation ios7 uicollectionview