简体   繁体   English

带有iOS 9.3的XCode 7-约束在iPhone模拟器中有效,但在iPad模拟器中运行时会添加边距

[英]XCode 7 with iOS 9.3 - Constraints Works in iPhones Simulator But When Running in an iPad Simulator a Margin is Added

I'm creating a very simple project, but I can't make the constraints work perfectly both in iPhones and iPad, there's this wierd behavior when I execute the app in an iPad simulator (images below). 我正在创建一个非常简单的项目,但是我无法使约束在iPhone和iPad上都能完美地工作,当我在iPad模拟器中执行该应用程序时,会有这种奇怪的行为(下图)。

I read that there's some differences in the margins between iphones and ipad and even though I tried to find help I couldn't figure it out how to solve this problem. 我读到iphone和ipad之间的边距存在一些差异,即使我试图寻求帮助,也无法弄清楚如何解决此问题。

It's seems like the problem is in the View Margins... I tried to put this code in my appDelegate: 看来问题出在“查看边距”中...我试图将这段代码放在我的appDelegate中:

UITableViewCell.appearance().preservesSuperviewLayoutMargins = true
UITableViewCell.appearance().contentView.preservesSuperviewLayoutMargins = true

that I founded in this link UITableViewCell with autolayout left margin different on iPhone and iPad 我在此链接UITableViewCell中创建的具有自动布局的左侧边距在iPhone和iPad上有所不同

but doesn't worked! 但是没有用!

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

Thanks in advanced for any help. 非常感谢您的任何帮助。

Silly Mistake, I didn't set in DEVICES to Universal. 愚蠢的错误,我没有在“装置”中设置“环球”。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM