Xcode iPhone simulator acting funky

2019-09-19 11:15发布

问题:

I have just begun an iPhone app tutorial. What shows up in my storyboard is starkly different to what shows up in the iPhone simulator:

One shows the "Hello World" message as being on the left

The other shows it on the right

The window is maxed out, so it's not just a viewing error. Any suggestions?

回答1:

I think you should start learning Auto Layout and after that add some constrains to your label



回答2:

What you want to do is got to View > Utilities > Show the attributes inspector Under Simulated metrics change the Size (which is Inferred by default) depending from what you want..

Note: Make sure you have selected your view controller, see the image...

for dynamic approach..

Make use of your autolayout and set constraints.. at the bottom right of the storyboard click Align and set your prefered Alignment Constraints..

I'm out here, Cheers to you sir..



回答3:

The location of the label is the same if you don`t use autolayout correctly.

Select the label and add the constraint, you can play with these and auto adjust the frame.



回答4:

Set your layout to compact width | regular height



回答5:

Ok two things i want to tell you here !! What you see in storyboard is not what gets rendered in simulator !, the storyboard is just for your visual assistance , but if this is puzzling you , do one thing go to storyboard ->identityInspector(top right side panel) select 4th tab -> simulated Metrics ->size (click on it and find the one simulator on which you are running).

2nd thing -> if you want the frames be adjusted as per changing resolution ,you better make sure to use autolayout and set appropriate constraint .



标签: ios iphone xcode