2012-10-26 132 views
0

我必须使用其中的不同单元格的tableview。我有三种喜好,桌子取决于他们。可能有6种不同的表格 - 1格,1格和3格,没有格,2格和3格等,这取决于偏好动态tableview单元格创建

这是最好的方法吗?

也许有人知道很好的例子,或教程在这个

回答

1

你可以做只有一个UITableView有不同的部分。

根据您的部门ID,您可以在

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

indexPath将返回不同的单元格中包含row & section值。

你也可能会在部分返回不同数量的行用:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 
1
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 
//pass value to numper of cells; 
return 4 (or) 2; 
} 

//use this to add cell 
[tableview reloadData]; 
相关问题