我正在做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)]>" )
而不仅仅是调试它.