Ios – How to remove the border around (UITableView) grouped textfields

iosobjective cuitableview

The cells of my UITableView are grouped text fields. When I run my code on the emulator, I get this:

Grouped text fields and button

As you can see there is a gray area around the text fields while the background of the UITableView and the button is white. Is it possible to remove, or make invisible, the gray border (not the separator or the frame but the area) around the grouped cells? If so, how can I do that?

Update: Background color is working on iPhone but not on iPad. I'm working on iPad.

I fixed the problem. Solution:

UIView *clearView = [[UIView alloc] initWithFrame:[myTableView bounds]];
clearView.backgroundColor = [UIColor clearColor];
myTableView.backgroundView = clearView;
[clearView release];

Since setting the background on the xib file is not working, I did it programatically. Here, myTableView is the tableView object on the xib. As you can see, I replaced the background view with a view that has a clear color (transparent). The desired effect is achieved.

Best Answer

If you mean the table view's background colour you can do it in the nib

enter image description here

Making the background colour clear just means you have to be aware of what is behind the table - as you will then see that!

If you mean the gray lined border You have to do it in code.. So in say the viewDidLoad method of the table view's owning class.

self.tableView.separatorColor = [UIColor clearColor];