我在哪里设置 cellForRowAt 中 tableview 单元格的 backgroundImage .. 我该怎么做?我就是这样做的,它有点工作,但我想知道设置背景图像()的正确方法是正确的,它是在“如果”的cell.backgroundView
内部还是外部。?if(cell==nil)
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"RootViewCellIdentifier";
UITableViewCell *cell = [_tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image1.png"]];
}
return cell;
}