Jesse
Jesse

Reputation: 2684

XCode 7 Storyboard UI Issue

Ever since updating to XCode7/iOS9 something very strange seems to be happening. In my storyboard layout, the views are still the fixed 320 x 568. I was having an issue where a good chunk of the right side of the screen was being cut off when I would run the iPhone 6 simulator. So I created a new test project with storyboard and 1 view. I added a sub view, set it's background red, and made it the same size as the parent: 320 wide and set a width constraint of 320 on it. My expectation is that the red subview will scale to any size iPhone screen width.

enter image description here

What I get is the following:

enter image description here

So I logged self.view.frame.size.width and it is saying the width is 375. In the storyboard, I set the width of the red subview to 375, updated the width constraint to 375 and what do you know...it fills the width of the parent view perfectly as it should.

The problem is, I shouldnt have to do this. Why would I do my design off the screen?

Is there something Apple is trying to force here that I am not doing? I never had this issue in Xcode 6.

Upvotes: 0

Views: 306

Answers (1)

Mitchell Currie
Mitchell Currie

Reputation: 2809

You're missing constraints as far as I can see. Please add constraints as appropriate. Recommend you add the Left and Right margins, and Top space + height.

I.e., Click the square when your "red" view is selected, then click the left, right and top sides of the box. Then click the "height" field and then "add constraints"

Upvotes: 1

Related Questions