【发布时间】:2012-12-14 08:59:23
【问题描述】:
我想在调用动作时为 UICollectionViewCell 设置动画。
我在Interface Builder 中完成了UICollectionViewCell,也完成了UICollectionView。
现在我想在我的actionBtnAddToCard 方法中获得正确的indexPath。
这就是我现在尝试的方式(ProduktViewCell.m 中的方法):
- (IBAction)actionAddToCart:(id)sender {
XLog(@"");
// see this line
NSIndexPath *indexPath = ??** how can i access the correct indexPath**??;
SortimentViewController *svc = [[SortimentViewController alloc] initWithNibName:@"SortimentViewController_iPad" bundle:[NSBundle mainBundle]];
[svc.collectionViewProdukte cellForItemAtIndexPath:indexPath];
[svc collectionView:svc.collectionViewProdukte didSelectItemAtIndexPath:indexPath];
}
SortimentViewController 是继承 UICollectionView 的 viewController。
如何访问正确的 indexPath?
更新 1:编辑帖子以便更好地理解。
【问题讨论】:
-
看看这个 SO 答案,这是一种更优雅和简单的方式stackoverflow.com/questions/13966291/…
标签: ios ibaction uicollectionview nsindexpath uicollectionviewcell