有没有办法减少UITableView的两个部分之间的空间?每个部分之间大约有15个像素.我确实已经尝试返回0 -tableView:heightForFooterInSection:,-tableView:heightForHeaderInSection:但这并没有改变任何东西.
有什么建议?
我有一个分组的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) 我正在使用UITableView多部分列表。我看到的问题是每个部分的单元格上方有一个空格,即使我设置tableView(_:heightForHeaderInSection:)为 0。即使只有一个部分并且我设置tableView(_:viewForHeaderInSection:)为,也会发生这种情况nil。
我已经尝试了 StackOverflow 上与插入覆盖/边缘扩展相关的所有其他答案,但没有一个有效。
例子:
我有一个分组样式的UITableView,只有一个部分.但是,当用户滚动得太远时,在表视图的上方和下方会显示一些空白区域.如何删除此空白区域?
我为iOS 8制作了一个应用程序,它使用分组UITableView作为其中一个页面.其中有多个部分使用CGFloat.leastNormalMagnitude(或CGFloat.min在Swift 2及以下版本中)用于剖面页眉和页脚高度以删除"默认"空间.一切顺利,直到应用程序在iOS 9和10中运行,它崩溃了这个错误:
由于未捕获的异常'NSInternalInconsistencyException'而终止应用程序,原因:'section header height不能为负 - 提供的第0部分的高度为-0.00000'
不知何故,1除了舍入之外的任何值0都被视为否定 - 并且使用1返回值将使页眉/页脚空间再次出现.
有没有解决方法来解决这个问题?
提前致谢.
uitableview ×5
ios ×3
iphone ×2
swift ×2
ios10 ×1
ios4 ×1
ios9 ×1
ipad ×1
objective-c ×1
uikit ×1