Search code examples
objective-cios7storyboardautolayoutautoresizingmask

How to use auto lay out, auto resizing , to make Screens for iphone 4,5,6 using same storyboard


I used to make 2 XIB files for iphone4 and iphone 5, seprately. Since we have more number of devices like iPhone 4,5,6 etc(ipads too), It will be very hard to make different XIB file for all.

I never used storyboard before. Now I have started to use storyboard. I was designing the View Controllers, for iphone 5, how to make it for iphone 4 and 6 (using the same storyboard). I run the app it was working fine on iphone 5 , but when I ran it over 4, (as the screen size is small) few components were hidden from view.

Then I read about Autolayout and auto resizing , I read few Tutorials too, about them, like from raywaldernich.com etc etc. But I was not able to use the autolayout thing properly(I can say), the view were still distorted on iphone 4.

I really donot know from where to start. I donot want to make another Storyboard file. Autolayout, resizing, not working for me, as I desired. Please guide.... and I donot want to set frame of every UI component programatically, that will be very time consuming


Solution

  • Apple has great guide for AutoLayout

    Check it out https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/Introduction/Introduction.html

    Now I'm using Autoresizing masks, it's much more simple than AutoLayouts
    https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/CreatingViews/CreatingViews.html#//apple_ref/doc/uid/TP40009503-CH5-SW5