相关疑难解决方法(0)

当节为空时,分组的UITableView显示空白区域

我有一个分组的UITableView,其中并非所有部分都可以一次显示,该表由一些数据驱动,而不是每个记录都有.我的麻烦是,没有某些部分的记录在表格中显示为空白(见图)

替代文字http://img220.imageshack.us/img220/5633/screenshot20100322at228.png

没有页脚/标题.我错过了什么?

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
return [self getRowCount:section];
}


// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}

cell.textLabel.text = [NSString stringWithFormat:@"section: %d row: %d",indexPath.section,indexPath.row];
// Configure the cell...

return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

    float …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uitableview

24
推荐指数
4
解决办法
1万
查看次数

标签 统计

iphone ×1

objective-c ×1

uitableview ×1