【发布时间】:2015-11-09 13:48:57
【问题描述】:
_studentListTableView.separatorStyle =UITableViewCellSeparatorStyleSingleLine;
_studentListTableView.separatorColor = [UIColor redColor];
上面的代码在 iPhone 中运行良好,但在 iPad 中,在下面的屏幕截图中显示的左右边距中显示了更多空间,这是 iPad 中的默认行为吗?也使用 SeparatorInset 为 tableview 是 UIEdgeInsetsZero 虽然左侧显示更多空间。
这里绿色是tableview,红色是分隔符颜色,灰色是单元格颜色
为什么这种行为会在 iPad 中发生?
注意:在 iPhone 中它可以正常工作。
下面是“cellForRowAtIndexPath”代码
NSString *reuseIdentifier = [NSString stringWithFormat:@"%ld_%ld",(long)indexPath.section,(long)indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
if(cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
}
cell.backgroundColor = [UIColor grayColor];
cell.textLabel.text = [NSString stringWithFormat:@"Student %li",(long)indexPath.row];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
【问题讨论】:
标签: ios uitableview ipad