我有这个 UITableView,我在其中解析了来自 web 服务的数据并加载到 NSDictionary 中,它一切正常,数据显示 id 和 imageurl 到 tableview 问题是 logo-id,当我向下滚动 tableview 时,它是一个 int 完美显示但是当我向上滚动表格视图时它消失了,当我向下滚动它时它再次出现并停留在那里
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
//Where we configure the cell in each row
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell;
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
// }
// Configure the cell... setting the text of our cell's label
NSDictionary *dic = [json objectAtIndex:[indexPath row]];
NSString *strImage = [dic objectForKey:@"image-name-small"];
NSURL *ImageURL = [NSURL URLWithString:[strImage stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
AsyncImageView *asyncImgView = [[AsyncImageView alloc] initWithFrame:CGRectMake(3, 10, 100, 100)];
asyncImgView.contentMode = UIViewContentModeScaleAspectFit;
asyncImgView.backgroundColor = [UIColor clearColor];
[asyncImgView loadImageFromURL:ImageURL];
UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(200, 200, 100, 25)];
lbl.text = [dic objectForKey:@"logo-id"];
[cell addSubview:lbl];
[cell addSubview:asyncImgView];
cell.textLabel.text = @"";
return cell;
}