相关疑难解决方法(0)

减少UITableView各部分之间的空间

有没有办法减少UITableView的两个部分之间的空间?每个部分之间大约有15个像素.我确实已经尝试返回0 -tableView:heightForFooterInSection:,-tableView:heightForHeaderInSection:但这并没有改变任何东西.

有什么建议?

iphone uitableview ios

139
推荐指数
7
解决办法
9万
查看次数

当节为空时,分组的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万
查看次数

iOS 15:删除 UITableView 中单元格之前的空白区域

我正在使用UITableView多部分列表。我看到的问题是每个部分的单元格上方有一个空格,即使我设置tableView(_:heightForHeaderInSection:)为 0。即使只有一个部分并且我设置tableView(_:viewForHeaderInSection:)为,也会发生这种情况nil

我已经尝试了 StackOverflow 上与插入覆盖/边缘扩展相关的所有其他答案,但没有一个有效。

例子:

iOS 表格视图的屏幕截图。 每个节标题上方都有一个间隙,其颜色与表格背景颜色相同。

uitableview uikit ios swift

23
推荐指数
2
解决办法
7604
查看次数

如何从UITableView中删除页眉和页脚空间?

我有一个分组样式的UITableView,只有一个部分.但是,当用户滚动得太远时,在表视图的上方和下方会显示一些空白区域.如何删除此空白区域?

uitableview ipad ios4

22
推荐指数
1
解决办法
3万
查看次数

为UITableView节头返回CGFloat.leastNormalMagnitude会导致崩溃

我为iOS 8制作了一个应用程序,它使用分组UITableView作为其中一个页面.其中有多个部分使用CGFloat.leastNormalMagnitude(或CGFloat.min在Swift 2及以下版本中)用于剖面页眉和页脚高度以删除"默认"空间.一切顺利,直到应用程序在iOS 9和10中运行,它崩溃了这个错误:

由于未捕获的异常'NSInternalInconsistencyException'而终止应用程序,原因:'section header height不能为负 - 提供的第0部分的高度为-0.00000'

不知何故,1除了舍入之外的任何值0都被视为否定 - 并且使用1返回值将使页眉/页脚空间再次出现.

有没有解决方法来解决这个问题?

提前致谢.

uitableview ios swift ios9 ios10

9
推荐指数
1
解决办法
3907
查看次数

标签 统计

uitableview ×5

ios ×3

iphone ×2

swift ×2

ios10 ×1

ios4 ×1

ios9 ×1

ipad ×1

objective-c ×1

uikit ×1