Auto Layout Worth It?

Discussion in 'iOS Programming' started by loon3y, Jul 1, 2013.

  1. loon3y, Jul 1, 2013
    Last edited: Jul 1, 2013

    loon3y macrumors 65816

    loon3y

    Joined:
    Oct 21, 2011
    #1
    I know its good when changing form landscape to portrait orientation

    but is it good for transitioning from iPhone Storyboard to iPad? the iPhone version is going to be only portrait but the iPad version of my app will support landscape orientation and portrait. (the iPad storyboard is just going to be a bigger version of the app [bigger/more images, bigger tableview, it will not have any split views or multiple tableviews] almost exactly the same)



    edit: my boss wants me to use auto layout, but im spending a ridiculous amount of time trying to understand it and use it, time in which i can just adjust everything manually on IB or do some coding

    is it really worth it? does it really help transition from iPhone Storyboards to iPad Storyboards?
     
  2. bridgeyman macrumors member

    Joined:
    Mar 16, 2008
    #2
    Converting an already-working app to Auto Layout may not be worth it. Luckily, Auto Layout plays nicely with autoresizing masks. Under the hood, it actually translates the autoresizing masks into NSLayoutConstraints, so they mix together well. Just write the new stuff in Auto Layout, and keep the old stuff as-is.

    One advantage of converting completely to Auto Layout, even if your app already works, is localization. Some controls may need to get bigger/smaller to contain other languages. When using autoresizing masks, this meant creating a separate xib for each language. With Auto Layout, one only needs one xib.

    I helped work on Auto Layout as an intern. If you want to chat one-on-one with questions, you can pm me.
     
  3. ChristianJapan macrumors 601

    ChristianJapan

    Joined:
    May 10, 2010
    Location:
    日本
    #3
    Actually I also started with some auto layout recently but it drives me a bit crazy; specially while in XCode and change the layout. While runtime I actually very much like it. Makes modification of layout while device rotation very easy.

    I use UICollectionViewCell and Auto Layout. To make life easier for me I made sure to define constraints top-left-focused to be able to change size of cell views. In addition I use a number of embedded views to easier rearrange groups of elements.

    But as soon as I change size of surrounding views the content get messed up; random offsets to button of cells etc. very difficult and time consuming to design and correct.
    I suppose I do something wrong; is there a good video/tutorial/hint to layout more complex layouts ?
     
  4. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #4
    Ray Wenderlich suggests not dragging elements anymore, but instead using the Editor menu of Xcode. It's discussed towards the end of this tutorial:

    http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2
     
  5. KoolStar macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #5
    In XCode [Redacted] auto layout has gotten the much needed improvements. I tend to use it now for all my apps that I am updating to iOS [Redacted].
     
  6. cledet macrumors regular

    cledet

    Joined:
    Mar 26, 2012
    Location:
    San Francisco, CA
    #6
    Yeah but it's extremely buggy and crashes Xcode for me. I've been back and forth on adopting Auto Layout with my existing apps. Maybe someday.
     
  7. KoolStar macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #7
    I seem to have pretty good luck i have a few controllers in my storyboards that have upwards of 50 constraints for a number pad and it get slow but not crashing.
     
  8. loon3y thread starter macrumors 65816

    loon3y

    Joined:
    Oct 21, 2011
    #8

    wow 50 constraints? that'll give me a headache


    so auto layout is the way to go huh? its the future?


    im assuming apple is going to come out with different sized screens (bigger & smaller iPads/iphones than the ones that are out right now)
     
  9. KoolStar macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #9
    Its seems the best way to handle the difference in screen sizes. Without a lot of manual coding.
     

Share This Page