iOS Interface Builder with XIB VS. Objects Programming

lasash

Suspended
Original poster
Sep 15, 2012
36
0
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
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
8,662
4,225
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.
 

dejo

Moderator
Staff member
Sep 2, 2004
15,981
450
The Centennial State
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.
 

firewood

macrumors 604
Jul 29, 2003
7,755
1,013
Silicon Valley
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.
 

xStep

macrumors 68020
Jan 28, 2003
2,013
100
Less lost in L.A.
Programming your own UI elements allows for more extensive customization than is otherwise possible.
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.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
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.
 

lasash

Suspended
Original poster
Sep 15, 2012
36
0
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!
 

moral-hazard

macrumors regular
Jul 27, 2009
180
0
Palo Alto, CA
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 ;)
 

lasash

Suspended
Original poster
Sep 15, 2012
36
0
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 ;)
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...
 

lasash

Suspended
Original poster
Sep 15, 2012
36
0
iOS 6's Auto Layout should address your concern pretty significantly, I think.
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.
 

Similar threads

Register on MacRumors! This sidebar will go away, and you'll see fewer ads.