Setting Grouping in UITableView under UINavigationController

Posted by climbon on Stack Overflow See other posts from Stack Overflow or by climbon
Published on 2010-03-22T03:13:20Z Indexed on 2010/03/22 3:21 UTC
Read the original article Hit count: 265

Filed under:

In my UINavigationController app, my first view is a UITableView. I can't seem to find a way to set the property of this UITableView to 'grouped'. Since UITableView is dynamically generated I don't have the luxury of Interface Builder.

Searched forums here and googled other places and closest I saw was to override either initWithStyle or initWithCoder as follows.

  • (id)initWithStyle:(UITableViewStyle)style {

    if (self = [super initWithStyle:UITableViewStyleGrouped]) { } return self; }

However this above function never gets called.

when I overrided initWithCoder I could see it worked and I was able to change UITableView contents to grouped. But then title automatically became 'Root View Controller' and none of the cells were active anymore although they got grouped fine. That is while they looked active but if you click on them, those cells won't do anything.

But I have seen apps which have their very first view being UITableView is grouped. So there must be a way to do it but I don't know how.

© Stack Overflow or respective owner

Related posts about iphone-sdk