开发者

Why does the iOS Simulator show only a blank view/window?

开发者 https://www.devze.com 2023-02-03 22:37 出处:网络
I\'m new to iOS development. I used the Interface Builder to add text fields 开发者_如何学Cand buttons to my view. When I run the app, the iOS Simulator only shows an empty beige screen. What am I mis

I'm new to iOS development. I used the Interface Builder to add text fields 开发者_如何学Cand buttons to my view. When I run the app, the iOS Simulator only shows an empty beige screen. What am I missing? The console doesn't show any error.


It is because you have not connected your view to your File's Owner.

To do this Right Click on the View, Control Click on the Oultlet of your View and drag it to the File Owner.

This shall solve your problem.

Cheers


I reckon it's because you have AutoLayout turned on in your storyboard, but haven't set any constraints.

Follow my instructions in the following article, to confirm if this is true.

AutoLayout problem

Basically, with XCode 6, if you have AutoLayout turned on, you must set constraints on every single control... otherwise your screens will look fine within XCode, but the controls in your screen could (and will) end up anywhere and in any size when the app is run.

It's like designing a beautiful webpage, then displaying it in an angry, drunk, disorientated browser.

XCode is really unintuitive, and unhelpful for beginners... but once you learn the rules of AutoLayout (along with its many quirks), it's reasonable useful.

0

精彩评论

暂无评论...
验证码 换一张
取 消