I just started working with Auto Layout and my app will be in landscape mode. The app must be available for iPhone and iPad. What settings do I need to set for this? any - any in Auto layout? It should support iPhone 5 and later. And when I add a custom font in a text to my project in Any - Any, it looks of course smaller on an iPad because the screen is bigger. When I adjust the font to Regular width and any height and test it, it custom font is disappeared. Is this because I am using the wrong settings now? And when I insert an image, will it automatically be bigger on iPad?
Thank you very much!
In fact, there can be a lot of width/height settings for just "landscape mode, iPhone 5 or later".
If you open an interface builder file, you can click on the "wAny hAny" thingy to see what settings are suitable for what device.
For example, in the screenshot here, The settings "Regular Width | Compact Height" are for 5.5 inch phones in landscape mode:
If you don't know what size each iPhone model is, here's a simple chart:
Size (in) Model
3.5 4S
4 5
4.7 6S
5.5 6S Plus
Related
I am trying to use adaptive layout in Xcode 7.1 for iPhone app. I am using 3 sizes iPhone device 5.5, 4.7 and 4.0 inches. When I added a background UIImageview, it fits nicely on all 3 iPhone screens. Please refer attached screenshot. I did pin option to Add 4 sides constraints with 0 values. Background fits to all 3 iPhone sizes screen fine.
Now, I am trying to add a UITextview in all 3 iPhone sizes screen. Now, this text view doesn't fit properly in all 3 iPhone sizes screen
Please find the screenshot reference below. How to make this textview properly placed on all 3 iPhone screens just below Employee ID label?
Follow this image and set your constraints like wise....
You have to set constraints to fit textfield properly. Firstly you have to set size class before setting constraints to handle orientation. like size class with respect to device size in this screen shot size class RH/CW set for portrait orientation. And set set constraints to fit UITextfield
I am developing an iPhone app and I have a few sets of labels which is fetching data from an XML feed. However, initially I designed the app for the iPhone 5 (with the bigger screen) and when I change it to 3.5 inch retina, the labels are displaced as seen in the photos.
iPhone 5 4.0 inch label
http://i.stack.imgur.com/d4LXp.png
iPhone 4 3.5 inch label
http://i.stack.imgur.com/OPNpn.png
Thus when clicking on the toggle button for designing for 3.5 inch and then editing it, then the 4 inch retina design will be displaced. Does anyone know how I can overcome this issue? Thanks. I am obviously using the storyboard to edit the files.
Mikkel, it depends if you are using Autolayout or not. To check if it's enabled, go to the File Inspector (Command+Alt+1) and see if the checkbox Use Autolayout is on or off).
If you are not using Autolayout: you will need to configure the AutoResizing Masks. In order to do so, go to the Size Inspector (Command+Alt+5). Then, for each label, you set the left margin and the top margin as fixed (the red line, not the arrow).
If you are using Autolayout: in the same size inspector, configure correctly the constraints to left and top as fixed, and it should be fine.
I'm creating an app using xcode 4.5 that is meant to support only the 3.5 inch retina display. Thus, in the attributes inspector for the view controller I have set the size to be 3.5 inches. However, I'm testing my app on a iphone 5 and the app auto-resizes to fit the whole screen. Do you know why this is happening? How can i make the app remain in 3.5 inches of size even when viewed off of a iphone 5?
Thanks
If you remove the default 568h#2x icon from your project the app will run the way you want. On the iPhone 5, you will get black bars on top and bottom to show what it would look like on the 4. Hope this helps.
The answer is - you can't do that :) But you can download ios5 simulator and set it's device property to 3.5 screen device
I have a very simple app that just displays a block of text every time you touch the screen. I have a graphic behind the text, that the basics of it.
I made it back in 2010 using a .xib file to create the text field and the image.
I'm now attempting to make it fit both iPhone 5 and both iPad and iPad Retina.
I can't simply stretch out the existing .xib layout because it just accepts and renders the last one I do. (If I stretch to iPhone 5 resolution it goes off the screen on an iPhone 4S).
Is there anyway to reference different .xib files based on the iOS device?
Thank You.
According to the documentation, you can use:
myNibName~ipad.xib and
myNibName~iphone.xib
and the correct xib will be loaded depending on the device.
You can read iOS Supports Device-Specific Resources.
EDIT:
how do you distinguish between iPhone 3.5" vs iPhone 4.0"
there is no device modifier specific to the iPhone 4". You will have to define your nib in a way that it can "stretch" vertically.
The only mechanism is a iPhone 4" specific Default-586#2x.png file. If you provide it, then the whole screen area will be available to your app.
If you do not provide it, then the app will run in a special mode whereby its content is presented in a 3.5" area. The remaining area is filled with a top and a bottom black band.
iPad vs iPad Retina?
nothing special here, since the 2 devices share the same "logical" resolution of 768x1024 pixels. As usual, you can use #2x modifier to supply specific retina-resolution images; and, if you need it, you can use ~ipad#2x modifier to supply retina iPad-only images.
E.g.:
iconImage.png -> non-retina iPhone version
iconImage#2x.png -> retina iPhone version (also retina iPad version if no ~iPad is given)
iconImage~iPad.png -> non-retina iPad version
iconImage~iPad#2x.png -> retina iPad version
EDIT:
To make your UI stretch, go to the metrics pane in IB and set the vertical spring for the view height (this is the inner vertical double arrow in the picture below).
You will have to find your way through this a bit, especially if you have a lot of subviews.
My views created for iPad form factor look fine in Interface Builder. However, when I debug my app in iPhone Simulator 3.2 (with Hardware -> Device set to iPad), I see the UI clipped and about half size. There is a 2x button at the bottom which lets me zoom in. But this just shows the same clipped UI in double size.
This is really weird since I have created the XIB for iPad form factor and it is supposed to fit iPad completely. Any ideas what I might be doing wrong?
I am using iPhone SDK 3.2 downloaded on 4/30/2010.
Thanks.
-Raj
It sounds like you've accidentally created an iphone project, rather than an ipad project. In the "New Project Dialog", make sure you select iPad from the "Product" dropdown in the middle of the dialog:
alt text http://www.freeimagehosting.net/uploads/7f49d44254.png