2013-07-19 116 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

相關問題