Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS7 UICollectionView如何使用动画将单个单元格移动到不同的分区?_Ios_Objective C_Animation_Ios7_Uicollectionview - Fatal编程技术网

iOS7 UICollectionView如何使用动画将单个单元格移动到不同的分区?

iOS7 UICollectionView如何使用动画将单个单元格移动到不同的分区?,ios,objective-c,animation,ios7,uicollectionview,Ios,Objective C,Animation,Ios7,Uicollectionview,我有一个应用程序,上面有用户可以阅读的文章列表。用户点击一篇文章后,我想将其呈现给用户,然后设置动画,将代表文章的单元格移动到另一个集合视图部分,代表已阅读的文章: Unread | Read 0 0 0 0 | X X 下面的代码导致所有单元格重新加载,看起来它们都以背景色闪烁。有没有一种方法可以让我将一个单元格从集合视图的一个部分移动到另一个部分 您是否查看过-moveItemAtIndexPath:toIndexPath:?听起来这正是你想要的 您似乎正在更改支持集合视图的数据,然后依

我有一个应用程序,上面有用户可以阅读的文章列表。用户点击一篇文章后,我想将其呈现给用户,然后设置动画,将代表文章的单元格移动到另一个集合视图部分,代表已阅读的文章:

Unread  | Read
0 0 0 0 | X X
下面的代码导致所有单元格重新加载,看起来它们都以背景色闪烁。有没有一种方法可以让我将一个单元格从集合视图的一个部分移动到另一个部分

您是否查看过-moveItemAtIndexPath:toIndexPath:?听起来这正是你想要的


您似乎正在更改支持集合视图的数据,然后依赖-reloadSections:更新UI。毫不奇怪,这会重新加载分区中的每个单元格。由于您确切地知道所执行的更改,您至少可以使用-DeleteItemSatinExpaths:和-InsertItemSatinExpaths:来准确地指示删除和重新插入此图像的位置。

您是否成功找到了将项目移动到另一个带有动画的分区的方法?
-(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) {

    }];

}