20

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

3 Answers 3

59

To remove gray background:

tableView.backgroundColor = [UIColor clearColor]; in viewDidLoad

or if above code doesn't work try this.

tableView.backgroundView = nil; 
Sign up to request clarification or add additional context in comments.

Comments

6

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; 

Comments

3
tableView.backgroundColor = [UIColor clearColor]; 

If you are using Interface Builder make sure you setup and connect your outlet for the tableView

You may want to call this method in viewDidLoad:

1 Comment

+1 for mentioning the viewDidLoad. In complex view hierarchy the table will ignore any background property changes.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.