使用静态单元格删除UITableView剖面边框和背景颜色? [英] Remove the UITableView Section Border and Background Color with Static Cells ?

查看:83
本文介绍了使用静态单元格删除UITableView剖面边框和背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有静态单元格的 UITableView 来制作一个小表格。

I am using UITableView with static cells to make a small form.

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

I added number of sections in the UITableView but now I have to remove the background color and the border of the section that displays the Login and Forgot Password button.

查看下面的截图。

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

How can I remove the background color and the border?

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

Also is there anyway to change the background color of the view. This view inherits from UITableViewController. I believe that I need to change the color of section or the group.

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

I assigned the identifier to the cell and got to remove the background color.

- (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; 


推荐答案

我想你想做一个基于的交换机你在sectionForRowAtIndexPath中的部分。然后用透明的视图替换该行的背景。

I think you want to do a switch cased based on your section within cellForRowAtIndexPath. Then replace the background of that row with a view that's transparent.

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;
        }
}

这篇关于使用静态单元格删除UITableView剖面边框和背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆