isparkdev
isparkdev

Reputation:

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

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 color.If i try to change background color using backgroundcolor property i get a plain view without any texture.

thanks

Upvotes: 18

Views: 44384

Answers (4)

Lars Blumberg
Lars Blumberg

Reputation: 21461

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

Upvotes: 0

Aswathy Bose
Aswathy Bose

Reputation: 4289

tableview.backgroundView = nil;
tableview.backgroundColor = [UIColor clearColor];

This may help you in solving your problem

Upvotes: 75

edzio27
edzio27

Reputation: 4140

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.

Upvotes: 0

Rog
Rog

Reputation: 17170

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

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.

Upvotes: 13

Related Questions