我如何才能找到indexPath
用于cell
在中间UICollectionView
?
我有水平滚动,只有一个大的cell
是可见的(cell
在侧面也可以看到另外两个)。我需要删除cell
中心位置(均值-current cell
)而不要触摸它。
仅按“废纸“”按钮并确认删除。但现在它仅删除前cell
一个。
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
if (buttonIndex == actionSheet.destructiveButtonIndex) {
initialPinchPoint = ????????
self.tappedCellPath = [self.collectionView indexPathForItemAtPoint:initialPinchPoint];
Technique *technique = [arrayOfTechnique objectAtIndex:self.tappedCellPath.row];
[self deleteData:[NSString stringWithFormat:@"DELETE FROM TECHNIQUES WHERE TECHNIQUENAME IS '%s'",[technique.techniquename UTF8String]]];
[arrayOfTechnique removeObjectAtIndex:self.tappedCellPath.row];
//[arrayOfTechnique removeObjectAtIndex:[custom_layout ]];
[self removeImage:technique.techniquename];
[self.collectionView performBatchUpdates:^{
[self.collectionView deleteItemsAtIndexPaths:[NSArrayarrayWithObject:self.tappedCellPath]];
} completion:nil];
[self checkArrayCount];
}
}
就像您自己做的一样,这indexPathForItemAtPoint
是查找您感兴趣的元素的索引路径的一种好方法。如果您的问题是:我怎么知道该点的坐标?然后,您应该尝试使用(使用与您的代码段相同的名称):
initialPinchPoint = CGPointMake(self.collectionView.center.x + self.collectionView.contentOffset.x,
self.collectionView.center.y + self.collectionView.contentOffset.y);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句