简体   繁体   English

我所有的对象都在我的iOS模拟器中消失了,为什么?

[英]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.

相关问题 为什么我的UIDatePicker在iOS9中消失了? - Why did my UIDatePicker disappear in iOS9? 为什么报摊是我在IOS模拟器中的唯一应用? - Why is newsstand my only app in IOS simulator? 当我将模拟器旋转到横向模式时,为什么某些静态单元格从模拟器屏幕上消失了? - Why do some of my static cells disappear from the simulator screen when I rotate the simulator to a landscape mode? 为什么我的iOS模拟器无法置于AZERTY模式 - Why my iOS simulator can't be put on AZERTY mode 为什么在iOS模拟器上看不到我的应用程序图标? - Why can't I see my app icon on iOS simulator? 为什么我的按钮会更改iOS模拟器中的填充? - Why does my button change padding in the iOS simulator? 为什么我的iOS模拟器中出现此Transform错误? - Why am I getting this Transform error in my iOS simulator? 为什么我的应用程序在 iOS 模拟器中打开后立即退出? - Why my app immediately quit after open in iOS simulator? 为什么我的App在iOS Simulator中总是向右移动? - Why is my App always shifted to the right in the iOS Simulator? 为什么我的应用程序不能安装在模拟器或设备上 iOS xcode - Why won't my application install on simulator or device iOS xcode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM