2013-07-19 35 views
0

好吧,在检查了很多SO答案之后,我发布了这个。 我想做一个自定义的uitableviewCell,其中我有一个uiimageview和uilabel。 问题是,当我加载单元格时,它仅在uitableview中加载替代图像,并为每个单元格加载用于uilabel的正确数据。 它应该在所有的细胞加载图像有时misplaces在错误的细胞图像也在替代单元格中显示图像的自定义uitableviewcell

下面是我在做什么...

第1步:

#define kActivityCell @"ActivityCell" 

第2步:

[self.feedTable registerNib:[UINib nibWithNibName:kActivityCell bundle:nil] 
     forCellReuseIdentifier:kActivityCell]; 

步骤3:

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 
    // format for feeds 
    NSLog(@"row no: %d",indexPath.row); 

    ActivityCell *activityCell = (ActivityCell *)[tableView dequeueReusableCellWithIdentifier:kActivityCell forIndexPath:indexPath]; 

    //selection color 
    UIView *selectionColor = [[UIView alloc] init]; 
    selectionColor.backgroundColor = [GeneralUtils colorWithString:kTableSelectionHEX]; 
    activityCell.selectedBackgroundView = selectionColor; 


    [activityCell listOfLikeSetting]; 

    ZDUser *newObject = [likeArray objectAtIndex:indexPath.row]; 
    activityCell.nameAndDesc.text = newObject.display_name; 
    activityCell.nameAndDesc.font = [GeneralUtils FontSettingBold13]; 
    activityCell.objectID = newObject.userID; 
    activityCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 

    // this method is from AFNetworking Lib 
    [activityCell.photoLeft setImageWithURL:[NSURL URLWithString:newObject.avatar]]; 

    // this is my own method to cache images, but i am not using it right now. 
    // [activityCell.photoLeft setProfileImageFor:newObject.avatar]; 

    return activityCell; 
} 

我已经创造了ActivityCell一个单独的类和厦门国际银行是有我在其中适当地作出了连接的IBOutlet中的UIImageView photoleft

按现在,我无能,为什么它的发生有人请分享你的想法... 这里是我已阅读的一些链接,但它并没有帮助我。

Lazy load images in UITableViewCell

UIImageView not showing up in custom UITableViewCell

UITableViewCell load images and reused cells

回答

0

这个问题现在解决了,这是因为使用相同的电池,在许多地方,并根据需要,所以有一些内部问题定制的。 我现在已经为它创建了一个新类,它工作正常。

谢谢 Sumit

相关问题