使用静态单元格删除UITableView剖面边框和背景颜色?

我正在使用UITableView和静态单元格来制作一个小forms。

我在UITableView添加了多个部分,但现在我必须删除背景颜色和显示“ 登录忘记密码”按钮的部分的边框。

看看下面的截图。

在此处输入图像描述

问题1

如何删除背景颜色和边框?

问题2

无论如何还要改变视图的背景颜色。 此视图inheritance自UITableViewController 。 我相信我需要改变部分或组的颜色。

我将标识符分配给单元格并删除了背景颜色。

 - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { if([cell.reuseIdentifier isEqualToString:@"ButtonsCell"]) { cell.backgroundColor = [UIColor clearColor]; NSLog(@"login buttons cells found"); } } 

这是图像:

在此处输入图像描述

但边界仍然显示!


很奇怪,但有效!

 cell.backgroundView = nil; 

我想你想根据你在cellForRowAtIndexPath中的部分做一个开关。 然后用透明的视图替换该行的背景。

 switch (section) { case BACKGROUND_SECTION: { // Only way I could find to get row centered segmentCell.selectionStyle = UITableViewCellSelectionStyleNone; [segmentCell setAccessoryType:UITableViewCellAccessoryNone]; // Make the cell background transparent UIView *backView = [[UIView alloc] initWithFrame:CGRectZero]; backView.backgroundColor = [UIColor clearColor]; segmentCell.backgroundView = backView; } }