ios9.0以后 uicollectionview 拖拽 怎么固定某个cell无法移动,别的cell拖动时也无法挤压这个cell?用iOS9.0以后的方法,有人知道吗?
- (NSIndexPath *)collectionView:(UICollectionView *)collectionView targetIndexPathForMoveFromItemAtIndexPath:(NSIndexPath *)originalIndexPath toProposedIndexPath:(NSIndexPath *)proposedIndexPath{
if([self.adapter checkEditableOfIndexPath:proposedIndexPath]){
return proposedIndexPath;
}
return originalIndexPath;
}
UICollectionView代理方法,判断proposedIndexPath是否可编辑,返回合适第indexpath
case UIGestureRecognizerStateChanged:
{ // 手势改变
// iOS9方法 移动过程中随时更新cell位置
NSIndexPath *indexPath = [self.collectionView indexPathForItemAtPoint:[longPress locationInView:self.collectionView]];
if (!indexPath) {
break;
}
if (indexPath.row == 需要固定的row) {
return;
}
[self.collectionView updateInteractiveMovementTargetPosition:[longPress locationInView:self.collectionView]];
}
break;