Interface Builder with XIB VS. Objects Programming

Discussion in 'iOS Programming' started by lasash, Sep 30, 2012.

  1. lasash macrumors member

    Joined:
    Sep 15, 2012
    #1
    As a beginner in iOS programming, I have a question, which is quite philosophical:

    Interface Builder with XIB files VS. controllers and objects via programming - what are the pros and what are the cons?

    Is programming the objects more neat and "professional", or is it just a clever way to say "I am so good that I don't need a GUI"?

    Thank you for your answers,
    Liroy
     
  2. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    Programming your own UI elements allows for more extensive customization than is otherwise possible. It is not an indication that you are "so good you dont't need a UI editor" but an indication that you're so naive that you thought it was a good idea to use non-standard UI elements.

    Just use the UI editor. It'll achieve more professional looking results, and more user friendly results, much quicker.

    The only time you should be coding your own UI is if you want a unique, immersive experience, like a game designer might want.
     
  3. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #3
    Just because you use IB and XIBs, doesn't mean you should stop also using controllers and objects. XIBs address the "V" part of the MVC design pattern. You still should be writing code for the "M" (model) and "C" (controller) portions.
     
  4. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #4
    Depends on how you like to design things. If visually, then IB allows you to see positions and spacings and stuff as you design. But if you want numeric positions, for instance if you want to animate something around in a hyperbolic path ending up some golden ratio below some other element, then working with numeric coordinates in code might work better.
     
  5. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #5
    I dont' think that is the question. Rather, I think the question is simply, does not using IB present it self as being clever enough not to use IB?

    I know people who avoid IB so that they can avoid the possible traceability issues associated with it when problems pop up. Others think IB should be used to it's full capability before considering dropping down into code.

    The thing I like about IB is that you can often understand the layout of a UI when it is used well. This can be quicker than digging through code. As they say, a picture is worth a thousand words. IB comes with more information than just the picture.

    No matter what side you personally choose, or middle ground, learning both techniques will be advantageous.
     
  6. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #6
    In any non-trivial app it will be impossible to do all the UI in IB. In my apps it's probably 90% IB, 10% code.

    Anyone who tells you that they use code because it gives them more control than IB simply doesn't understand IB. It is faster to build the UI using IB. And it makes more sense to design a graphic UI using a graphic tool. This is an area that Apple is always improving.
     
  7. lasash thread starter macrumors member

    Joined:
    Sep 15, 2012
    #7
    So...

    So I decided, after reading all your comments guys, to use the UI Builder mostly, but use a bit of a objects programming when necessary.

    Thank you for your comments!
     
  8. moral-hazard macrumors regular

    Joined:
    Jul 27, 2009
    Location:
    Palo Alto, CA
    #8
    I view IB and custom UI code as complementary -- I think it would be pretty painful to try to build iOS apps without one or the other. IB frees you up from doing a lot of mundane calculations and writing boilerplate (ex. positioning/centering views, inserting subviews, setting default values/properties of UIView's, etc) and the storyboarding provides a great view of control flow (at least for simple apps). That said, it's tough to build a professional-looking application without diving in to write some custom views, animations, and the like. I think it's hard to fulfill your product's vision without doing so. Long story short, leverage IB as much as you can, but know it's limitations and don't be afraid to dive in and write some cool, customized views ;)
     
  9. lasash thread starter macrumors member

    Joined:
    Sep 15, 2012
    #9
    Agreed.
    For my level now as a novice, I use the IB for my simple objects in the app.
    I'm guessing that in the future I will have to use custom objects created using programming.

    However, I despise the XY positioning...
     
  10. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #10
    iOS 6's Auto Layout should address your concern pretty significantly, I think.
     
  11. lasash thread starter macrumors member

    Joined:
    Sep 15, 2012
    #11
    Are you talking about the Constrains line added to each view in the IB editor?
    If so, I disabled it. It drove me nuts, couldn't positing anything properly with the mouse.

    I was talking about the XY positioning in the code, where you can't see where you are location your object.
     

Share This Page