在 UICollectionView 中,当我选择一个单元格时,它会打开一个新的 UIViewController,其中会显示一些信息。
- (void)collectionView:(UICollectionView *)collectionView
didDeselectItemAtIndexPath:(NSIndexPath *)indexPath
{
MyClass *myClass = [myClassArray objectAtIndex:indexPath.item];
[myClass MyClassInstanceMethod];
}
在新
UIViewController
关于 myClass
的一些信息打印实例。然而,在 MyClassInstanceMethod
我做了一些HTTP
requests
它获取一些数据并分配给myClass
的属性。你可能猜到了,问题是 HTTP
requests
延迟,我无法在新 View 加载之前获取要分配的数据。那我觉得我应该让我的
UICollectionView
在 MyClassInstanceMethod
之后打开选定单元格的页面完成它的工作 .我该如何实现?提前致谢。
最佳答案
据我了解,
你必须进行 http 调用
- (void)collectionView:(UICollectionView *)collectionView
didDeselectItemAtIndexPath:(NSIndexPath *)indexPath;
并且在成功响应中,您应该打开您的 UIViewController 并在其中显示您想要显示的详细信息。
关于ios - UIColliectionView的collectionView如何使用 :didDeselectItemAtIndexPath method asynchronously,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36982075/