UITableViewのスタイルをnibを使わずにGroupedに指定する方法

http://developer.apple.com/jp/iphone/library/documentation/UserExperience/Conceptual/TableView_iPhone/CreateConfigureTableView/chapter_5_section_2.html

以下のメソッドをUITableViewControllerクラスのサブクラスに実装。

- (void)loadView {
    UITableView *tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStyleGrouped];
    tableView.delegate = self;
    tableView.dataSource = self;
    self.tableView = tableView;
    [tableView release];
}

リファレンスには、UITableViewのプロパティに、styleというのがあったので、これで簡単にスタイルをセットできるかと思いきや、このプロパティはreadonlyでした。styleを設定するには上記のようにinitWithFrame:style:メソッドで指定するしか方法がなさそうです。これをloadViewメソッドにて行なうと言うことで、少々大げさなコードになりますね。