0
在我的故事板,我有一个UITableView,它具有以下属性动态分组表格单元格
Style: Grouped
Content: Dynamic Prototypes
我的问题是,如何使不同的群体。当我现在运行应用程序时,没有白色的支持(只有默认的内衬支持),文本放在顶部。另外,如果我创建了这些动态组,我将如何设置它们的页眉和页脚?
感谢
在我的故事板,我有一个UITableView,它具有以下属性动态分组表格单元格
Style: Grouped
Content: Dynamic Prototypes
我的问题是,如何使不同的群体。当我现在运行应用程序时,没有白色的支持(只有默认的内衬支持),文本放在顶部。另外,如果我创建了这些动态组,我将如何设置它们的页眉和页脚?
感谢
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2;
}
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
// implement your code
}
-(NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section{
//implement your code
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
/// Write basic code//
switch (indexPath.section) {
case 0:
//It belongs to first group and implement your code.
break;
case 1:
//It belongs to second group and implement your code.
break;
}
我认为这将有助于你
如何把不同的物品,每组?现在与代码row.item == 0所有组获取该项目。 – CoreCode
此外,白色不出现在项目后面。 – CoreCode
实现' - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath'方法并使用indexPath.section。 –