2011-10-05 38 views
1

当我的.xib文件加载这时间UITableViewCell是装满了黑色背景颜色,对于这一点,我使用如何使透明的UIButton中的UITableView细胞

cell.contentView.backGroundColor = [UIColor blackColor] 

UITableViewCell一个UIButton用“自定义“按钮类型是由程序生成的 因此该地区涵盖UIButton是不是transparent(或单元格背景 - 黑颜色不显示),它是一种白色,,,

我要让UIButton使用透明背景

SO我怎么能?

+0

您是否使用自定义单元格? –

回答

1
UIButton *button; 
button.backgroundColor = [UIColor clearColor]; 
+0

亲爱的,朋友我也试过这个,但它不起作用, – prithvi

+0

我在UITableViewCell – prithvi

+0

请提供您用来创建按钮的代码。 – Nekto

1
try this one it work for me 
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 
     [button addTarget:self 
        action:@selector(aMethod:) 
     forControlEvents:UIControlEventTouchDown]; 
     [button setTitle:@"Show View" forState:UIControlStateNormal]; 
     button.frame = CGRectMake(0.0, 5.0, 160.0, 40.0); 
     [button setBackgroundColor:[UIColor clearColor]]; 
     [cell.contentView addSubview:button]; 
+0

谢谢你,我的朋友,这是工作.. – prithvi

0

你为什么不使按钮的图像与你想显示和添加为按钮的背景与按钮类型的自定义文本一起。