Getting back Struts and Springs

Discussion in 'Mac Programming' started by ArtOfWarfare, Nov 22, 2012.

  1. macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #1
    Hi guys, I thought I'd share this for anyone else who despises the new Constraints Auto-Layout system:

    To turn it off, go into your interface file, choose the document tab (the leftmost one in the tab bar on the right panel.) and uncheck the box "Use Auto Layout"

    And bam, just like that, it tosses out the hundreds of complicated constraints (which do anything but "just work" like Apple's docs say they do,) and takes you back to the actually auto-magical system of struts and springs.

    I can't say how many times I've been working on an Android app in Eclipse and just wished they had a layout system anywhere near as simple as struts and springs. I was dumbfounded when I saw Apple had actually duplicated the freaking nightmare that is Android UI design (okay, maybe not quite duplicated... they don't force you to pick from a dozen layouts like Android.)

    Oh, and as a further nail in the coffin for Constraints and Auto-Layout, it means that Snow Leopard users can't use your app. (As much as I like Lion/ML, I still hear that tons of my customers use SL, so I consider it essential that I continue to support it.)
     
  2. macrumors regular

    Joined:
    Nov 9, 2011
    #2
    Good Tip

    I couldn't get an auxiliary panel to look right in an NSSavePanel. A popoup menu was clipped. It turned out that Auto Layout was the problem and it took me a long time to figure it out.
     
  3. macrumors 603

    nuckinfutz

    Joined:
    Jul 3, 2002
    Location:
    Middle Earth
    #3
    http://blog.ideveloper.tv/podcast-73/

    Erica Sadun brings up a great point about how the experiences of constraints varies drastically depending on how much you use Interface Builder or not.
     
  4. macrumors G5

    gnasher729

    Joined:
    Nov 25, 2005
    #4
    Ahem... struts and springs work "auto-magically" up to some degree, and then it breaks down. There are plenty of things that you just can't do. And good luck if you have views where the width or height can be changed to zero.
     
  5. macrumors member

    Mark FX

    Joined:
    Nov 18, 2011
    #5
    Thanks ArtOfWarfare.

    I was wondering if there was a way of getting the struts and sprigs back.

    Regards Mark
     
  6. ArtOfWarfare, Jul 13, 2013
    Last edited: Jul 13, 2013

    thread starter macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #6
    I'm going to now mock myself of yesteryear by beginning this post the same way I started the original one:

    Hi guys, I thought I'd share this for anyone who despises the Constraints Auto-Layout system:

    First off, a comic explaining how you feel:

    [​IMG]

    Next, a tutorial that should help you understand why the new system is helpful and how to use it:

    http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2

    But now, I think I'd like to mention one thing that Struts and Springs easily has on Constraints which might lead to Constraints becoming less despised by people transitioning:

    Struts and Springs clearly showed which ones were turned on (as Constraints do) AND also showed what potential additions could be made. Making those additions were as easy as clicking on them. I think Constraints should be always visible directly in the interface to be easily turned on.

    And I suppose I'll share an anecdote of this sudden turnabout from a Constraint hater to lover:

    I was Googling about an hour ago "What is the longest international weekday title?" I have a label that needs to hold a weekday name but no more. I know that Wednesday will take up the most space in English, but who knows what crazy weekday names German, for example, has (as it turns out, it looks like Icelandic might actually have the longest names for weekdays... or possibly Indian...)

    Then I realized the absurdity of what I was looking for, thought, "there has to be a better way", and then I realized the better way had to be within abandoning struts and springs and going to constraints. The tutorial I posted actually mentions that constraints solve exactly this kind of problem.
     
  7. ArtOfWarfare, Nov 16, 2013
    Last edited: Nov 16, 2013

    thread starter macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #7
    Even better reference than my prior one:

    WWDC 2012 session 232: Autolayout by Example

    If you don't love auto layout by the end of it, you've never managed a project with localization and you've never made a UI with more than 2 views in it.
     
  8. macrumors 6502a

    Joined:
    Jun 21, 2010
    #8
    Thanks AoW, good job finding this setting.

    I have an Xcode project set to build for a 10.6 target, but for some reason it decided to use Autolayout, which of course doesn’t work on 10.6.
     

Share This Page