Friday, January 27, 2012

UITableView grouped

When I am trying to implement a window under IOS, it is quite simple Table View, but I want it to have round corner, the grouped style UITableView, but some how I can't make that happen even after I set the TableView's style to "Group", but it still display as a plain style.
After some investigation , I found out it is to do with the way I create the view object. 

I was using something like the following to create the table view. 
TableView *view = [TableView alloc] init];
In this way, the UITableView's style will always be set to UITableViewStylePlain, the correct way to do it is 
TableView *view = [TableView alloc] initWithStyle:UITableViewStyleGrouped];

or TableView *view = [TableView alloc] initWithNibName:@"MyTableView" bundle:nil];

It is a simple issue, but just write down in case somebody else is still wandering... The final result should looks like the following.


No comments:

Post a Comment