如何为表格中的每个按钮添加图像
我在表格中有 8 个按钮,我想为每个按钮放置不同的图像
我有这个如何修改代码以接受 8 张图片
- (UIImage *)cellBackgroundForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSInteger rowCount = [self tableView:[self tableView] numberOfRowsInSection:0];
NSInteger rowIndex = indexPath.row;
UIImage *background = nil;
if (rowIndex == 0) {
background = [UIImage imageNamed:@"Button01.png"];
} else if (rowIndex == rowCount - 1) {
background = [UIImage imageNamed:@"Button02.png"];
} else {
background = [UIImage imageNamed:@"Button03.png"];
}
return background;
}