看來我的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」];'是做到這一點的正確方法 –