iphone如何让uitableviewcellaccessorydisclosureindicator背景透明?

时间:2010-08-13 21:54:33

标签: iphone objective-c uitableview transparent

有人可以向我解释如何在UITableViewCell透明中制作uitableviewcellaccessorydisclosureindicator的背景吗?

现在我正面临这个问题:

alt text http://www.bubl3r.com/disclosure.jpg

3 个答案:

答案 0 :(得分:5)

刚刚找到答案。原来它只有3行&必须使用透明背景定义我自己的披露指标.png图像:

UITableViewCell *bgView = [[UITableViewCell alloc] initWithFrame:CGRectZero];
    bgView.backgroundColor=indexPath.row % 2? [UIColor colorWithRed:0.95 green:0.95 blue:0.95 alpha:1]: [UIColor whiteColor];
    bgView.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"disclosure.png"]];
    cell.backgroundView=bgView; 


    return cell;

答案 1 :(得分:4)

UITableView的委托中,覆盖委托方法tableView:willDisplayCell:forRowAtIndexPath:。在那里,将单元格的backgroundColor属性设置为任何颜色,附件视图的背景颜色应该匹配。

答案 2 :(得分:3)

来自anshuchimala的答案的更多细节:

cell.contentView.backgroundColor=[UIColor grayColor];//or any color
cell.backgroundColor=[UIColor grayColor];
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
cell.accessoryView.backgroundColor=[UIColor clearColor];