differences between xcode interface builder and IOS simulator - xcode

I'm new to Xcode and I'm having a problem between interface builder and iphone simulator
As you see below, I set the imageview size for simulator, but some buttons places are changed, button texts disappeared or even buttons disappeared.
http://postimage.org/image/w9ej1c3z1/
I just open a new project and add buttons like the image below, then run the project. Same thing again! I'm doing something wrong?
http://postimage.org/image/6gl55tehd/
xcode version is: 4.5.2
Ios simulator version is 6.0

Please make validate your design by clicking on "Apply retina 4 form Factor" button at the bottom of view controller upon selection...
if you click on that button, It will change to simulator size and you can check the design

It looks like your view is for a 4" screen but you are running in the 3.5" simulator. You will probably just need to play with the autoresize a bit to make it work correctly.

Your interface builder is set for the resolution of an iPhone 5. Your simulator is on the resolution of an iPhone 4S. In the Simulator menu bar select Device -> Hardware - iPhone 5 (Retina) and you will see your additional buttons.
Here is a pretty good tutorial which explains how to support both the iPhone 5 and <= iPhone 4S screen resolutions. Working with iOS 6 Auto Layout Constraints in Interface Builder

Related

In Xcode 12, many XIBs are stuck with "View as: iPhone 11"—how can I fix this?

In Xcode 12, many XIBs are stuck with "View as: iPhone 11"—how can I fix this? I need to view as iPad.
Here is an example:
Similar questions about this (from past Xcode versions) have said to change "Size" property in "Simulated Metrics" in the Attributes inspector. However, here is what the options are in that list:
Bizarrely, most of my XIBs render as iPad but I can't change which iPad model is used. My app target only has iPad and Landscape orientations enabled:
So I'm very confused why it would show anything other than landscape iPad options in Interface builder. Also, my scheme is set to build on iPad.
Please let me know a solution!
Look at your first screen shot in the question. Look at the lower left. See where it says "View as iPhone 11"?
That's a menu. Click it and choose a different device from the menu.

iOS simulator is inconsistant to the preview in Xcode?

I choose 4.7-inch as the default layout in Storyboard to make prototype more easily. 4.7-inch is iPhone 6 according to this link on Apple website.
In Xcode Preview, it's ok to show the layout.
But in iPhone 6 simulator, the layout is inconsistent to Preview.
Is it a bug in Xcode's Preview? Thanks.
FYI, Auto Layout and Size Classes are enabled, but I haven't add any constraint yet.
If constraints are enabled in your storyboard, then add constraints to it to be sure your layout behaves as you expect !

Autolayout only installs selected phone size

I have an autolayout xib with Size Classes enabled. The view looks great in all the phone sizes under "Simulated Metrics" but when I install the app on the phone only the last layout that was selected under "Simulated Metrics" gets loaded. For example, if I choose iPhone 5.5-inch under simulated metrics and install it on an iPhone 4S the layout the iPhone 5.5-inch gets installed on the 4S, making it go off the screen.
Is there a setting or something I've messed up which says to only build the currently selected layout?

ipad storyboard in xcode cannot drag button

I'm running xcode 4.5.2 to write an iOS app for both iphone & ipad ("universal" app).
I'm able to use the iphone storyboard to drag & drop buttons, labels, etc onto it. In fact I have functioning code on the iphone side.
However, since the beginning, I have not been able to drag & drop anything onto the ipad storyboard. When I try to do so the buttons, labels, etc just "bounce off".
Is there a way to reset the iPad storyboard so that I can get a clean start? It potentially could be that I had mistakenly (this is my very first iOS app) dragged a view or view controller onto the ipad story board. I tried deleting it but the whole ipad storyboard disappears after that.
It is probably something very simple but I'm very new to this. Thanks.
You can only drag & drop items into a view if you are in the most "zoomed-in" way of viewing it. Try pressing the "=" in the bottom right corner when you bring up your iPad storyboard (this will toggle between the most zoomed-in and the most previous zoom out). Once it zooms you in all the way, try dropping something onto your view again.
EDIT: Per Xcode 8 Release Notes, Interface Builder should now allow editing at all zoom levels.

How to make an iOS app support landscape orientation in XCode?

How to make an iOS app support landscape orientation?
How do you make it support both landscape and portrait, where you can just press a button to activate it.
for any new people reading this old post just go to main.storyboard->click on the view controller click on simulated metrics (the fourth icon that pops up, looks kind of like a pentagon belt buckle)
then orientation->Landscape this is for Xcode 5

Resources