您好我想禁用uicollectionview的第一個單元格時編輯mode.I的確在cellforrow第一小區的UICollectionview用戶交互禁用,禁用其他幾個細胞也對滾動
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
MainCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
cell.curveimageView.image = nil;
if(indexPath.item == 0){
[cell.curveimageView setImage:[UIImage imageNamed:@"AddCell"]];
cell.subTitleText.text = @"New Cell";
if(isEditing){
[cell setUserInteractionEnabled:NO];
[cell setAlpha:0.5];
}
else{
[cell setUserInteractionEnabled:YES];
[cell setAlpha:1];
}
}
else{
[cell.curveimageView setImage:[UIImage imageNamed:@"FlowerImage"]];
cell.subTitleText.text = [NSString stringWithFormat:@"%ld%@",(long)indexPath.row,@"Hello is this looking ok"];
}
[cell setTag:indexPath.row];
return cell;
}
下面的代碼在第一次在編輯模式下,我可以讓用戶單擊所有單元格,但在滾動後,第一行中的幾個單元格會隨機禁用。任何人都可以爲我提供解決此問題的解決方案。
謝謝
Thanku,上面說的解決方案爲我工作。 – SMS