Xcode: layout good on 4S, 5/6 not - iphone

i have a simple label and a webview on my view controller. On 4s and 5 the width is perfect, but on 6, there is a "white band" on the right.. What do you need to configure in constraints, to let "grow" the webview in length on 5, and in width & length on 6/6+? Thanks

Autolayout classes are tricky part:
create all your components on w-Any, h-Any so they would appear on all iOS devices.
start creating constrains that targets certain device by
changing w-any, h-any to the one that you like.
reposition your label, and web view
bottom,left of your interface builder define new constrains for the label and web view based on margins.
you can add more labels/UI elements that would only appear on that class of devices (iPhone 6/6+)
You can check the layout without running the simulator:
https://developer.apple.com/library/ios/recipes/xcode_help-interface_builder/Chapters/PreviewingLayouts.html#//apple_ref/doc/uid/TP40009971-CH5

Related

Xcode Not Displaying Correct Size In Storyboard?

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

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.

Xcode iPhone 4/5 Screen Size Both

I am making an application in Xcode, and I need to make it for both iPhone 4 and 5. But since the iPhone 5 has a bigger screen, it messes my application up.
Once I place the labels for the size of iPhone 4 and then test it on the iPhone 5 the labels are all misplaced. Is there a way to make them stay?
You can use iOS 6's new autolayout feature (if you want to be iOS5-compatible, you can still have autoresizing masks).
You need to position your labels based on the View Height of the device(don't have to worry about width, since iPhone 4 and 5 both have the same width. But this would apply for a universal app targeting iPad and iPhone).
For instance, if yours is a View Based Application, find the view height of the superview using self.view.frame.size.height, and determine all label/view placements based on this property.
And test for both screen sizes on the iOS Simulator.