Change iPhone tableview (style grouped) background color while preserving texture

后端 未结 4 1099
北荒
北荒 2020-12-25 14:32

How can we change the background color of tableview (style grouped) while still preserving texture of thin columns/lines effect that we can see when it has the default blue

相关标签:
4条回答
  • 2020-12-25 15:03

    Firstly, you could try searching on Stack overflow for your exact question. Here's two:

    • How can I set the background of a UITableView...
    • How to customize the background/border colors of a grouped table view?

    If that doesn't help, try to make the background colour of the table view transparent [UIColor clearColor] and put another view behind your UITableview containing the colout/texture/image you need.

    0 讨论(0)
  • 2020-12-25 15:07
    tableview.backgroundView = nil;
    tableview.backgroundColor = [UIColor clearColor];
    

    This may help you in solving your problem

    0 讨论(0)
  • 2020-12-25 15:09

    Without needing to write code, simply select Clear Color for the table view's Background property in the View section.

    0 讨论(0)
  • 2020-12-25 15:17

    Create the property of tableView:

    @property (nonatomic, strong) IBOutlet UITableView *tableView;
    

    Then synthesize it:

    @synthesize tableView = _tableView;
    

    In implementation create method:

    - (UITableView *) tableView {
      [_tableView setBackgroundColor:[UIColor whiteColor]];
      return _tableView;
    }
    

    Remember also to connect your tableView in xib file, and it should work.

    0 讨论(0)
提交回复
热议问题