【问题标题】:[__NSCFNumber length]: unrecognized selector sent to instance 0xb000000000000113'[__NSCFNumber 长度]:无法识别的选择器发送到实例 0xb000000000000113'
【发布时间】:2018-04-20 04:34:40
【问题描述】:

我正在尝试在collectionView 中显示图像。从服务器获取 17 张图像的数据。我拿了一个名为ImageofarrayArray。我将 17 张图片附加到 array。当我要在collectionView 中显示时,它显示以下异常:

发送到实例的无法识别的选择器

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView
                 cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    ProudpartnersViewCell *myCell = [collectionView
                                     dequeueReusableCellWithReuseIdentifier:@"cell"
                                     forIndexPath:indexPath];
    myCell.layer.masksToBounds = NO;
    myCell.layer.shadowRadius = 5;
    myCell.layer.shadowOffset = CGSizeMake(0.0, 3.0);
    myCell.layer.shadowOpacity = 0.2
    NSString *strImg_Path = [[NSString alloc]init];

    NSString *arrayResult = [imageOfArray objectAtIndex:indexPath.row];  // error is here
    strImg_Path = [NSString stringWithFormat:@"%@",[NSURL URLWithString:arrayResult]];
    [myCell.proudOfImages sd_setImageWithURL:[NSURL URLWithString:strImg_Path]
                  placeholderImage:[UIImage imageNamed:@"placeholer_image"]];    
    return myCell;
}

谢谢你

【问题讨论】:

标签: ios objective-c arrays uicollectionview


【解决方案1】:

请按如下方式删除第 0 个索引整数组成数组

imageOfArray = ({ sponsorImage = "13.126.20.47/app/cykulpelotons/sponsors/images/pega.jpg";; }, { sponsorImage = "13.126.20.47/app/cykulpelotons/sponsors/images/yogabar.jpg";; }, { sponsorImage = "13.126.20.47/app/cykulpelotons/sponsors/images/cykul.png";; }, { sponsorImage = "13.126.20.47/app/cykulpelotons/sponsors/images/tsiic.png";; })

【讨论】:

    猜你喜欢
    • 2015-09-09
    • 2014-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-14
    相关资源
    最近更新 更多