Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set the background color of a grouped UITableView?

I want conjoined email & password textfields like so -

enter image description here

See how both the fields are nicely rounded & the background color is blue.

The way I have implemented this is to create a custom tableViewCell with a label and a text field in a grouped table view probably with a single section and two rows one of which is for username and other for password.

What I have got is below. I have come close to implementing this but I am getting a weird grey background. How do I get rid of this grey background?

enter image description here

like image 792
Srikar Appalaraju Avatar asked Dec 15 '11 16:12

Srikar Appalaraju


2 Answers

I think to remove gray background u should do one thing

tableView.backgroundColor = [UIColor clearColor]; in viewDidLoad

or if above code doesn't work try this.

tableView.backgroundView = nil;
like image 106
Rohit Dhawan Avatar answered Sep 28 '22 16:09

Rohit Dhawan


I accomplish this with two lines:

self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.backgroundView = nil;

Depending on the opacity you want you can also make sure of this:

self.tableView.opaque = NO;
like image 21
A Salcedo Avatar answered Sep 28 '22 17:09

A Salcedo