UICollectionViewCell
アクションが呼び出されたときにをアニメーション化したいです。 、も
実行しましたUICollectionViewCell
。今度は、自分の方法で正しい を取得したいと思います。Interface Builder
UICollectionView
indexPath
actionBtnAddToCard
これが私が今試している方法です (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: 理解しやすいように投稿を編集しました。
ベストアンサー1
- (IBAction)actionAddToCart:(id)sender {
NSIndexPath *indexPath;
indexPath = [self.collectionView indexPathForItemAtPoint:[self.collectionView convertPoint:sender.center fromView:sender.superview]];
...
}