私は画像をロードしています(イメージには長いジェスチャ認識機能があります)。 コレクションビューのセルが完全に読み込まれなかった場合、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