2012-08-08 59 views
2

我以編程方式創建tableView我想設置tableView樣式組,但如何給tableView alloc只有框架我們如何設置這個值。以編程方式創建分組樣式UITableView

+0

使用UITableViewStyleGrouped .... – IronManGill 2012-08-08 08:12:43

+0

可能重複[如何設置UITableView分組樣式](http://stackoverflow.com/questions/1006663/how-can-i-set-a-uitableview-以分組的樣式) – 2012-08-08 08:13:54

回答

6

參考下面的代碼。

UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0,your_width,your_height) style:UITableViewStyleGrouped]; 
2

您可以通過編程我不知道這樣

tableView = [[[UITableView alloc] initWithFrame:CGRectMake(0,0,320,460) style:UITableViewStyleGrouped] autorelease]; 
tableView.dataSource = self; 
tableView.delegate = self; 

[self.view addSubview:tableView]; 
1

添加它,我是否以正確的方式瞭解你的問題,但你可以構建一個GROUPE的tableView這樣:

UITableView* tview = [[UITableView alloc] initWithFrame:yourFrame style:UITableViewStyleGrouped]; 
相關問題