Xcode Not Displaying Correct Size In Storyboard? - iphone

I have an iPhone 6 to test my app i have my storyboard set to wCompact hRegular it says at the bottom this is for all iPhones in portrait and on the storyboard i can see all the content without a scrollview. However when i actually build and load the app to the device some of the content is off the screen when in the storyboard it shows otherwise. Does it not mean All iPhones in portrait or am i misunderstanding this feature of Xcode?

You are misunderstanding somewhat. Compact width regular height is a description of the style / shape / attributes of the screen for iPhones in portrait, not the actual size. They're all tall and skinny, but not all by the same amount or with the same aspect ratio.
Size classes allow you to logically group devices and orientations so you can specify the overall style of interaction that's appropriate, then allow auto layout to exactly configure the views to fit the available space.

Go to your storyboard and Select Your Viewcontroller in the right pane select show attribute inspector for the particular viewcontroller..and set Size to iphone 4.7 inch and orientation to portrait..and check your alignment is showing correctly ..check the image for references
http://i.stack.imgur.com/wrBSj.png

Related

Xcode 7: UITextview doesn't aligned properly for 3 different sizes iPhone screen

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

How to well adapt height and position of views in iOS without AutoLayout?

I am building a view in Storyboard. I have three parts :
1) top : real-time camera view (adaptive height)
2) middle : small webview (fixed height)
3) bottom : some buttons (fixed height)
I would like to know how to properly make my interface in the storyboard for a compatibility with iPhone 4 or iPhone 5 screens.
My goal is to have the camera having a bigger part of the screen on iPhone 5 (or any bigger screen) and the webview and buttons to have the exact same height on any device.
I did it quite well with the AutoLayout feature. The only problem is that it is available since iOS6 and my app has to work from iOS5 and above.
My Storyboard has an 4' display and when I try to run it on a real device (iPhone 4S) all the bottom of the screen is cropped and I can't see my buttons. I really can't figure it out what is really the best and proper way to do it. For a such simple problem, I shouldn't build two different storyboards.
Maybe should I try to fix the height of the camera view programmatically, but this won't fix the problem of the bottom of the screen cropped on smaller screens (I should then modify the position programmatically).
You can see that I haven't a really nice solution to my problem. Could someone help me in how using well the tools in XCode for this case ?
Thanks
Try this:
Xcode 4.5: How do I fix my text views so they display properly in portrait and landscape mode on an iPad?
I think this could fix your problem and if you are using Storyboards it makes it less difficult.

How to design single storyboard file that supports all iphone screen sizes?

I am using storyboard and xcode 4.6 for designing Iphone app. I have very complex viewscontrollers and some of the subviews(like scrollview's and autocomplete tablviews) have generated dynamically. When app build for iphone 4 everything works fine. But, when using Iphone(retina-4 inch) simulator, I noticed that there is space at the top and bottom of the screen and also some of the subviews (like scrollviews and autocomplete tableviews ..) misplaced and covering other subviews in that viewcontroller. I tried to search and found some are suggesting to design/load two xib files based on screen size. I have enabled both autoresize masks and autolayout, but still the problem persists.
How to design a single storyboard file that is feasible for both Iphone-4 and Iphone-5.
Reference:How to develop or migrate apps for iPhone 5 screen resolution?
Update attached screenshot:
Storyboard file
Thanks in advance...
use the button in the picture below to toggle between retina 4 in and 3.5 inch. use the autosizing tool under the size inspector on the top right to get views to position themselves correctly.

How do I provide iPad and iPhone 5 versions if I use .xib files?

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.

What resolution should I make my image backgrounds for my universal iOS app so that it supports the Retina display?

I have a universal iOS app with a custom view that has three buttons, each with an image background that extends to the sides of the screen for each orientation (portrait and landscape). The heights of each of the three buttons are the same and all three buttons take up the whole screen. So it looks simliar to this layout (image on the far right).
Since the widths and heights of each button are the same, I need to calculate how big (in pixels) I need to make each button image in order to support both orientations of the iPad and iPhone. On top of that, I also need to create higher res images to support the new Retina display. My questions are...
How do I calculate the resolution these images need to be for...
iPad in both portrait and landscape mode
iPhone in both portrait and landscape mode
iPhone with Retina display
Instead of having two sets of images to support both Retina and non-Retina displays, can I just use one hi-res set that will be scaled down to the non-retina displays? if so, is this a good idea?
If I add a navigation controller and/or a toolbar, what are the heights of these two view objects so I can adjust the heights of my images?
Thanks so much in advance for all your help! I'm going to continue searching for these answers right now.
Good info on porting apps / graphics to retina display is here
Essentially Apple created a new unit for graphics called "points" and if you add additional images to the bundle and use new API you can automagically load one or the other image.