How to change the border color of a Grouped UITableView

Posted by ctpenrose on Stack Overflow See other posts from Stack Overflow or by ctpenrose
Published on 2010-04-10T07:20:00Z Indexed on 2010/04/10 7:23 UTC
Read the original article Hit count: 861

Filed under:
|

This concerns iPhoneOS-sdk-3.2

I am having difficulty changing the border color of a grouped UITableView. I can change the cell background color, separator color, text color, quite easily now, and the rounded corners clip correctly, even when highlighted with whatever colors I have chosen. However the surrounding border remains infuriatingly gray despite many different attempts.

I have read all of the related posts I can find via Google, let alone stackoverflow.

I have tried both a programmatic and xib-based solution and both provide the same results.

I will share the programmatic version below:

I have a UIViewController subclass rather than a UITableViewController subclass to act as a UITableView delegate -- I chose this route as I am coding on the iPad and UITableViewController reportedly takes over the whole screen. loadView method of my UIViewController subclass:

- (void) loadView { self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; [self.view release]; self.view.backgroundColor = [UIColor blackColor]; // add and configure UITableView
CGRect tableViewRect = CGRectMake(0., 0., 256., 768.);

myTableView = [[UITableView alloc] initWithFrame:tableViewRect style:UITableViewStyleGrouped];

// set the tableview delegate to this object and the datasource to the datasource which has already been set
myTableView.delegate = self; myTableView.dataSource = self;

myTableView.sectionIndexMinimumDisplayRowCount=1;

myTableView.backgroundColor = [UIColor clearColor]; myTableView.separatorColor = [UIColor whiteColor]; myTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;

myTableView.opaque = NO;

// add the table view to our background view
[self.view addSubview:myTableView]; [myTableView release]; }

© Stack Overflow or respective owner

Related posts about iphone-sdk

Related posts about iphone-sdk-3.2