【发布时间】:2013-06-23 04:29:18
【问题描述】:
我正在这样做:
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:CellIdentifier];
cell.imageView.image = [UIImage imageNamed:[[self.articlesArray
objectAtIndex:indexPath.row]objectForKey:@"images"]];
// [cell.imageView setImageWithURL:[NSURL URLWithString:[[self.articlesArray
objectAtIndex:indexPath.row]objectForKey:@"images"]]];
}
return cell;
}
我正在这样做:
cell.imageView.image = [UIImage imageNamed:[[self.articlesArray
objectAtIndex:indexPath.row]objectForKey:@"images"]];
但我的UITableViewCell 中没有显示任何内容。
我想在左侧的tableViewCell 左侧显示图像,
请告诉我该怎么做。
【问题讨论】:
-
请确认
self.articlesArray已初始化,每个条目都包含一个带有键“images”的字典,键“images”指向一个 NSString 并且图像存在于主包中(因为你使用imageNamed:)。 -
是的 self.articlesArray 已初始化,每个条目都包含一个带有键“images”的字典,该字典指向一个像这样的 NSString “dem......p-content/uploads/2011/05/learn_t.jpg”
-
您发布的网址不完整。尝试将
[UIImage imageNamed:]的返回值设置为一个变量,并通过调试验证它不是nil。
标签: uitableview uiimage nsmutablearray arrays