看来我的tableview委托不会显示我的图像。该图像显示在我的视图控制器添加到我的UIImageView罚款。如果这一点信息有帮助,我正在使用接口构建器的表视图。UITableView不显示图像
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView setDelegate:self];
[tableView setDataSource:self];
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.accessoryView = [[UIImageView alloc] initWithImage:myimage];
return cell;
}
我尝试这样做,但我得到这个错误。 - [ViewController tableView:numberOfRowsInSection:]:无法识别的选择器发送到实例0x81ec820 –
确保您正在调用'numberOfRowsInSection:'方法。并返回您在阵列中拥有的对象数量。 – LAMBORGHINI
'cell.imageView.image = [UIImage imageNamed:@“image.png”];'是做到这一点的正确方法 –