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

查看:77
本文介绍了如何在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 。您可以使用它将表视图分隔符的insets设置为零,以使它们跨越屏幕的整个宽度。

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天全站免登陆