【发布时间】:2014-02-04 11:27:37
【问题描述】:
我有NSMutableArray *_items。具有 3 个属性。标签 (*text) 有标签 1000。图像 1001。
@property (nonatomic, copy) NSString *text;
@property (nonatomic, assign) BOOL checked;
@property (nonatomic, copy) UIImage *image;
问题是我无法显示图像。
_items = [[NSMutableArray alloc] initWithCapacity:20];
ChecklistItem *item;
item = [[ChecklistItem alloc] init];
item.text = @"Walk the dog";
item.checked = NO;
item.image = [UIImage imageNamed:@"img1.png"];
其余代码
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ChecklistItem"];
ChecklistItem *item = _items[indexPath.row];
UILabel *label = (UILabel *)[cell viewWithTag:1000];
UIImage *image = (UIImage *)[cell viewWithTag:1001];
image.image = item.image;
label.text = item.text;
[self configureCheckmarkForCell:cell atIndexPath:indexPath];
return cell;
}
【问题讨论】:
标签: ios objective-c xcode ios7