Xcode 7 iOS 9 UITableViewCell Separator插入问题 [英] Xcode 7 iOS 9 UITableViewCell Separator Inset issue

查看:70
本文介绍了Xcode 7 iOS 9 UITableViewCell Separator插入问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这不是问题,而是我所面临问题的解决方案.

This is not a question, rather a solution to the problem I faced.

在Xcode 7中,当应用程序在iPad设备上的iOS 9上运行时,UITableViewCellUITableView的左侧留有一些空白.并且将设备旋转到横向位置会增加边距.

In Xcode 7, when the application is run on iOS 9 on iPad devices, the UITableViewCell leaves some margin onto the left side of the UITableView. And rotating the device to the landscape would increase the margins.

我找到的解决方案是:

cellLayoutMarginsFollowReadableWidth设置为NO.

self.tbl_Name.cellLayoutMarginsFollowReadableWidth = NO;

此属性仅在iOS 9中可用.因此,您必须设置条件以检查iOS版本,否则它将崩溃.

This property is only available in iOS 9. So, you will have to put a condition to check the iOS version, else it will crash.

if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_8_1)
{
    self.tbl_Name.cellLayoutMarginsFollowReadableWidth = NO;
}

推荐答案

iOS 9及更高版本:

这是因为有一项称为可读内容指南"的新功能.它提供适合阅读的边距.因此,在iPhone和人像iPad上,它们的利润很小.但是从景观来看,iPad更大.在iOS 9中,UITableViewCell边距默认遵循可读内容指南.

This is because of a new feature called readable content guides. It provides margins that are suitable for reading. So, on iPhone and portrait iPad they are very small margins. But in the landscape, iPad they are bigger. In iOS 9, UITableViewCell margins default to following the readable content guide.

如果要停止此操作,只需将tableView的cellLayoutMarginsFollowReadableWidth设置为NO/false.

If you want to stop that, just set the tableView's cellLayoutMarginsFollowReadableWidth to NO/false.

来源: https://forums.developer.apple. com/thread/5496

这篇关于Xcode 7 iOS 9 UITableViewCell Separator插入问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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