微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ios – 为什么autolayout预览和实际设备不匹配

我正在做xamarin.ios,我正在做UI,即在 xcode自动布局.

在xcode预览中……我能够看到UI很好,但在某些设备的设备中,UI并不像预览中那样显示.

比如iPhone 5s,iPhone 6s plus.

有人可以解释一下它为什么会发生以及如何解决这个问题

谢谢

解决方法

导致自动布局错误的原因有很多.其中一些因为屏幕比例不同,其中一些因为iOS版本不同.

你看看你的调试器输出并检查这样的消息:

Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand,refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
    "<NSLayoutConstraint:0x7fc82d3e18a0 H:[UIView:0x7fc82aba1210(768)]>","<NSLayoutConstraint:0x7fc82d6369e0 H:[UIView:0x7fc82aba1210]-(0)-|   (Names: '|':UIView:0x7fc82d6b9f80 )>","<NSLayoutConstraint:0x7fc82d636a30 H:|-(0)-[UIView:0x7fc82aba1210]   (Names: '|':UIView:0x7fc82d6b9f80 )>","<NSLayoutConstraint:0x7fc82d3e7fd0 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7fc82d6b9f80(50)]>"
)

而不仅仅是调试它.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐