我有收集視圖裏面,我正在加載圖像(圖像有長按手勢識別器)。 集合視圖單元格未完全加載時,didSelectItemAtIndexPath方法未被調用。didSelectItemAtIndexPath沒有被調用,當單元格沒有完全加載
我向下滾動,並加載的一切,然後我把該小區的位置(截屏附後)現在didSelectItemAtIndexPath方法獲取調用下面
cellForItemAtIndexPath代碼: -
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
modelProductDetails=[self.productsArray objectAtIndex:indexPath.row];
PLPCollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"plpcollectiocellIdentifier" forIndexPath:indexPath];
[cell.imgview addGestureRecognizer:longPress];
cell.conlblofferpriceheight.constant=21;
cell.shareView.alpha = 0;
double actualPrice = [modelProductDetails.price doubleValue];// striked out
double offerPrice = [modelProductDetails.final_price doubleValue];//will be in red instead of special price
cell.lblitemPrice.text = [MyShoppingCartViewController displayFormattedPrice: modelProductDetails.price];
if (offerPrice < actualPrice && offerPrice != 0) {
NSMutableAttributedString *priceString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@" ,cell.lblitemPrice.text]];
[priceString addAttribute:NSStrikethroughStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(0, [priceString length])];
cell.lblitemofferprice.text = [MyShoppingCartViewController displayFormattedPrice:modelProductDetails.final_price];
[cell.lblitemPrice setAttributedText: priceString];
}
else
{
[cell.lblitemofferprice setText:nil];
}
cell.lblIteeTitle.text=modelProductDetails.brand;
cell.lblitemDescription.text=modelProductDetails.name;
cell.lblIteeTitle.text=modelProductDetails.manufacturer_value;
NSURL *url=[NSURL URLWithString:modelProductDetails.small_image];
[cell.imgview sd_setImageWithURL:url placeholderImage:nil];
UILongPressGestureRecognizer *longPressGes = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPressGestures:)];
longPressGes.minimumPressDuration = 1.0f;
longPressGes.allowableMovement = 100.0f;
[cell.imgview addGestureRecognizer:longPressGes];
[cell.shareButton setTag:indexPath.row];
[cell.addToWishlistButton setTag:indexPath.row];
[cell.shareButton addTarget:self action:@selector(shareAction:) forControlEvents:UIControlEventTouchUpInside];
[cell.addToWishlistButton addTarget:self action:@selector(addToWishlistAction:) forControlEvents:UIControlEventTouchUpInside];
cell.shareButton.tag=indexPath.row;
cell.addToWishlistButton.tag=indexPath.row;
return cell;
}
附加信息:只有右側的單元格有問題左側單元格工作正常
顯示您的代碼。 – Fogmeister
單元格中是否有任何按鈕? – sourav
@sourav單元格內沒有按鈕 – vijeesh