iOS simulator is inconsistant to the preview in Xcode? - 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 !

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.

xamarin forms restrict app's supported orientations

I am developing a xamarin forms app and I want to restrict the app's supported orientation to be Portrait only. I have indicated so in the info.plist file. But, the app still rotates when I rotate the device / simulator. What am I missing ?
This seems to be a bug in Xamarin Studio in that the GUI checkboxes only affect orientation for iPhone, not iPad. I will get a bug report filed, but in the meantime just view the Source for the Info.plist (Click the Source tab at the bottom of the Info.plist document and look for Supported interface orientations (iPad) which contains an array of values. Delete all of the values except Portrait (bottom button) from the array for Supported interface orientations (iPad)
UPDATE: Bug filed: https://bugzilla.xamarin.com/show_bug.cgi?id=50552

Swift - Problems with layout

I have a Universal application in Swift 2.0 developed in XCode 7.
On the storyboard simulated metrics, I have the 'size' set to 'iPhone 4.7-inch'.
When I run the application on my device (iPhone 5s), none of the labels are aligned and the toolbar is out of view. -This is also the case when I run using the iPad device in XCodes simulator.
Image of what the view controller contains ...
From the snippet above, when I run this VC on my iPhone there is no margin on the right side, and the toolbar is cropped off.
Can anyone advise how I can make a universal application show all the content in the VC, on all devices. Or how I would simply show the toolbar ...
That's what auto layout (constraints) is for.
On the storyboard simulated metrics, I have the 'size' set to 'iPhone 4.7-inch'.
That's irrelevant, and indeed misleading, since in means that only on the iPhone 4.7-inch will your app look like the storyboard design — unless you use auto layout.
iPhones come in many screen sizes. Basically, you have no way of knowing, as you design, what the screen size will actually be! Auto layout is the solution. Auto layout allows your interface elements to adjust automatically as the app launches on a particular size screen. iPads can serve as an extension of this — i.e., just an even larger size screen — or you can even use conditional constraints to make the interface quite different on the iPad from the iPhone, if desired - all designed in a single storyboard.
Maybe you are using auto layout and auto constraint. You could deactivate this in opening the storyboard, open up right panel , go to "show the file inspector" section and under Interface Builder Document uncheck auto layout and auto constraint
Image here
Select your item view, go into "Show the size inspector" and there you can set your autoresizing for all devices

Why my background are so big in simulator xcode?

why are my picture background so big in simulator but not in the layout. ?!
i have try to change from iphone to ipad but my problem still there.
printscreen:
[IMG]http://i59.tinypic.com/15y9r4g.png[/IMG]
Xcode 6 provide the facility to automatically adjust views. In order to disable this you must uncheck this. Select Your View Controller and disable Use auto layout.

differences between xcode interface builder and IOS simulator

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

Resources