[英]All of my objects disappear in my iOS simulator, why is that?
I'm currently working with one navigation controller, and 3 view controllers. 我目前正在使用一个导航控制器和三个视图控制器。 when i run my program, everything runs smooth, but none of my objects on my second and third view controller appear in the simulator ( labels, buttons, text fields etc.), how ever the navigation bar is there. 当我运行程序时,一切运行顺利,但是第二个和第三个视图控制器上的任何对象都没有出现在模拟器中(标签,按钮,文本字段等),无论导航栏在哪里。 why is that? 这是为什么? how do i fix it? 我如何解决它?
For me, the issue was that I had added the button to the LaunchScreen.storyboard, instead of the Main.storyboard. 对我来说,问题是我已将按钮添加到LaunchScreen.storyboard中,而不是Main.storyboard中。
Credit to this post: http://discourse.djp3.net/t/first-ios-app-button-and-label-disappear-in-simulator/104/13?u=drazisil 感谢这篇文章: http : //discourse.djp3.net/t/first-ios-app-button-and-label-disappear-in-simulator/104/13?u=drazisil
Apparently it was an auto layout error. 显然是自动布局错误。 I removed auto layout and disabled size classes from my project and the simulator showed every object within the interface. 我从项目中删除了自动布局和禁用尺寸类,并且模拟器显示了界面中的每个对象。 I then enabled both auto layout and size classes once again & manually added my constraints instead of allowing Xcode to do it for me. 然后,我再次启用了自动布局和大小类,并手动添加了约束,而不是允许Xcode为我做这些。 Worked out fine once i ran the simulator again. 一旦我再次运行模拟器,工作就很好了。 I think this is a bug in Xcode's iOS sim. 我认为这是Xcode的iOS Sim中的错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.