我只是有一个关于 tableView 的问题。
我知道我们可以返回节数和行数。
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
你能告诉我怎样才能拥有这样的东西吗:
- A section within a section (and another section, if possible) - - And then configure the rows there ?
我会返回什么
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
最佳答案
您将必须在 cellForRowAtIndexPath 中进行自己的实现,您返回的行实际上由多行组成,可能还有一个标题标签。或者更好的办法是让每隔一行成为“标题行”,然后在 cellForRowAtIndexPath 中检查你是在“标题行”还是普通行上;像这样:
if (indexPath.row == 0) {
// return header row
} else {
// return normal row
}
当然,在 numberOfRowsInSection 中,对于带有标题的部分,您必须返回正常的行数 + 1。
关于iphone - 一个部分中的一个部分 - UITableView -,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6280246/