1st Brisbane CocoaHeads meeting
July 8th, 2008
Yay we had our 1st meeting!! 9 developers attended plus a wife and child. We all sat around the tables and I gave an introduction to Objective-C and Xcode/Interface Builder to build two apps: one for Cocoa and one for the iPhone.
Well, it was one app – the RandomApp from Hillegass’s great book on Cocoa Programming
The iPhone app was almost a direct port of the Cocoa app. We used the “Cocoa Application” template for the Cocoa app, and then “View-based Application” template for the iPhone app. The latter creates two NIBs (.xib files), so you use the one who’s name starts with the application name (not MainWindow.xib). Both had the two buttons (“Change seed” and “Generate number”), both had a label for the output, and both had a controller to connect it all together.
The significant difference was that you use a UILabel for iPhone instead of NSTextField (configured as a Label). A minor difference in the Interface Builder – both called ‘Label’ in the Library – but their “set a value” APIs are different.
The NSTextField has both setStringValue: and setIntValue: methods via the NSControl superclass. The UILabel class did not; instead it has a text property (giving setText: and text setter/getter methods). So, to convert the generated integer into a string, we used:
textField.text = [NSString stringWithFormat:@"%d", generated];
Whereas for the Cocoa version with NSTextField we just did:
[textField setIntValue:generated];
Finally, the iPhone app was demonstrated being built and run on an iPod Touch. Sexy!
After the meeting, several people indicated they’d love a weekly “NSCoder” hacking session. No presentations, just sitting around and coding. What a great way to learn new things. More information to come.
It was a great first meeting. The next CocoaHeads meeting will be the 4th of August.
AGENDA:
Beginners: there are lots of Objective-C/Cocoa design patterns to discuss. Perhaps more useful for Cocoa + iPhone is delegates. Who’s up for doing 20minutes introducing them and showing a few very common uses of delegates + protocols?
Advanced: this will be our first meeting since the iPhone will have been released on the 11th of July. I’m confident various people will want to show off the interesting frameworks + code examples; such as for the GPS!
Sorry, comments are closed for this article.