Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does it feel like Interface Builder just gets in my way?

I'm very new to Cocoa for MacOSX, but I can't help but feel like I'm constantly fighting Interface Builder.

My current situation is that I'm building an app that will have several custom controls and views. I started building the app in Interface Builder because it was initially very easy to drag things around and get them into the correct spots with the proper colors and the correct autosizing rules. However the time has come to start building my custom controls and views - which I can't nicely represent in Interface Builder without going through the work of building an IBPlugin! The only other option I know of it is to have an Interface Builder document that includes a bunch of "Custom Views" all over the place with only their class changed. It suddenly seems pointless to even bother with IB - especially in light of that fact that these controls and views will have properties such as color that need to be set - just like the other views and controls already in the IB document. So now I've got visualization properties being set in two disconnected places and seems to counter one of the potential advantages of IB which is making it relatively easy to tweak the UI of the app without digging into code.

I'm also faced with a situation where a few controls change properties (such as colors) based on data or current selections. So now I have initial default colors of the control specified in Interface Builder, but I have to specify the data-driven colors in code? Once again Interface Builder seems to cause me to have to split some presentation settings between it's world and the code. I suppose it's possible to solve this somewhat with a complex plugin that knows about my data or states or whatever, but it seems like I'd end up maintaing a ton of support code that exists just so the Interface Builder experience remains "right."

Something else that I often see mentioned is how easily IB allows you to define bindings between components. "You can do it without writing any code!" Again, I may be missing something, but binding one property to another is a single line of code as far as I can tell. Is setting a couple properties in a box in IB really better than writing that one single line of code? And why is it better to put what amounts to application logic in the presentation layer's specification?

Like I said at the open, I'm pretty new to this Cocoa stuff, but I feel like either I'm missing something very important about how to use Interface Builder, or it's designed primarily for trivial demo applications with a high "wow" factor.

like image 211
Sean Avatar asked Dec 05 '22 04:12

Sean


1 Answers

I find that Interface Builder is excellent for getting the generic layout of an app. It's also wonderful for things like bindings (on the Mac). However, there's no way you're going to create Delicious Library using Interface Builder. The more complex your interface, the more code you'll have to write.

like image 52
Dave DeLong Avatar answered Dec 27 '22 11:12

Dave DeLong