I have been using Visual Studio since the Clinton administration. The Windows Form Designer is like a familiar old pair of jeans. Before that I used Borland's RAD tools. Their form designer is much the same. Interface Builder is...different. Not different in a bad way, just different.
I have been working through Erica Sadun's "The iPhone Developer's Cookbook". The section on using Interface Builder was particularly frustrating. She begins with a blob of code and discusses bolting a UI on it using Interface Builder. This seems exactly backwards -- I usually like to paint something up and then fill in the meaty logic. Beginning with the UI has the added advantage of something that you can show to stakeholders before you begin the heavy lifting.
There are a few screen shots sprinkled through the text but they could do with some annotation. Sadun says things like "Tap the application delegate object in your main XIB window. (It's the one that's not the file's owner or window)." Her screenshot shows three icons, so if you eliminate two you will know which one she means. I see four.
Youtube to the rescue. There are a lot of video introductions to making an app using Interface Builder. Many of them suffer from poor quality that leaves you unable to see exactly what someone clicked on or typed. This one was particularly good:
http://www.youtube.com/watch?v=Tz9mzB2fWhs.
Once you figure out how to wire up UI elements and how to associate events with buttons, it's really pretty nice. Press a button and some code gets generated for you. It's not like Visual Studio, where you get to see all the nitty gritty code that adds components to the forms and registers delegates. Instead we see a total separation of UI (stored in the XIB file) and business logic (in the generated classes).
Interface Builder enforces a strict adherence to the Model-View-Controller pattern. With Visual Studio forms, you will often see people mush together the UI and underlying logic in one awful mess. Interface Builder seems much more rigorous.
Armed with a better understanding after watching some YouTube videos, I managed to wire up Sadun's code to a UI to produce a trivial temperature conversion program.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment