Ios5 无法为分组表视图iOS 4中的表单元格设置背景图像
如果我在iOS5+中使用下面的代码行,它将非常好地工作Ios5 无法为分组表视图iOS 4中的表单元格设置背景图像,ios5,uitableview,ios4,colors,background-color,Ios5,Uitableview,Ios4,Colors,Background Color,如果我在iOS5+中使用下面的代码行,它将非常好地工作 cell.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.2]; 但这在iOS 4中不起作用。我也试过跟随,但不起作用 - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.2];
但这在iOS 4中不起作用。我也试过跟随,但不起作用
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.2];
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
for (UIView *subview in [cell.contentView subviews]) {
subview.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.2];
}
}
若我在willDisplayCell中设置了颜色,它会显示单元格的黑色背景。
如何设置在iOS 4和iOS 5中都适用的背景单元格颜色
感谢您的任何帮助。谢谢有关设置单元格背景图像的信息,请参阅此链接。谢谢链接。但我的问题已经解决了。问题在于线条[uicolorWithWhite:0.0 alpha:0.2];它应该是[UIColor COLOR WITH白色:1.0 alpha:0.2];