さて、多くのSOの回答を確認した後、これを投稿しています。カスタムを uitableviewCell にしようとしていますが、その中に uiimageview と uilabel が 1 つあります。問題は、セルをロードすると、uitableview でのみ代替画像がロードされ、各セルの uilabel の正しいデータもロードされることです。 すべてのセルに画像をロードする必要があり、間違ったセルに画像を誤って配置することもあります
これが私がやっていることです...
ステップ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 用に別のクラスを作成しました。xib があり、そこに ioutlet uiimageview photoleft の接続を適切に作成しました
今のところ、なぜそれが起こっているのか、誰かがあなたの考えを共有してくれる理由がわかりません...ここに私が読んだリンクのいくつかがありますが、それは私を助けませんでした.