如何在 iOS 7 上修复 UITableView 分隔符? [英] How to fix UITableView separator on iOS 7?

查看:21
本文介绍了如何在 iOS 7 上修复 UITableView 分隔符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UITableView 在 iOS 7 上用参差不齐的线条绘制:

UITableView draws with ragged lines on iOS 7:

如何解决?单元格之间的线应该在屏幕的整个宽度上.

How to fix it? The line between cells should be on the full width of the screen.

推荐答案

UITableView 有一个属性 separatorInset.您可以使用它来将表视图分隔符的插入设置为零,让它们跨越屏幕的整个宽度.

UITableView has a property separatorInset. You can use that to set the insets of the table view separators to zero to let them span the full width of the screen.

[tableView setSeparatorInset:UIEdgeInsetsZero];

注意:如果您的应用还面向其他 iOS 版本,您应该在调用它之前检查此属性的可用性,方法如下:

Note: If your app is also targeting other iOS versions, you should check for the availability of this property before calling it by doing something like this:

if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) {
    [tableView setSeparatorInset:UIEdgeInsetsZero];
}

这篇关于如何在 iOS 7 上修复 UITableView 分隔符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆