April 10, 2009
January 31, 2009
The latest screenshot of the upcoming Diablo 3

The latest screenshot of the upcoming Diablo 3

January 22, 2009

iPhone Protip: Fake navbar buttons

If you need to have a third button in your navigation bar, you’ve probably discovered already that you can’t add a UIBarButtonItem as you only have 2 slots for those, on the left and the right. There’s the titleView property, but you need to provide your own view and UIButton doesn’t have a style for bar buttons.

However, there is a reasonably easy solution. UISegmentedControl has a bar style that looks exactly like one of the buttons. The only problem is it doesn’t behave like a button. However, you can make a simple subclass that overrides the -touchesBegan:withEvent: and friends methods in order to make it behave like one after all. Now you can stick that in titleView and it looks just fine.

If you want it to be right-aligned on the bar, there’s another simple trick. Just create a UIView, set its frame to the bounds of the navbar, set your button as a subview right-aligned in the view and set the autoresizeMask to keep it there. UINavigationBar will resize the titleView to fill all the remaining space, which will mean your button is now right-aligned right next to the rightBarButtonItem.

January 20, 2009

iPhone Protip: nib top-level objects

When UIViewController loads a nib file, it does not retain all top-level objects in the nib (unlike MainWindow.nib where all top-level objects are retained). If you use top-level objects besides your view, you must make sure you implement the IBOutlets as retained properties.

January 15, 2009
January 4, 2009
December 28, 2008

Just picked up Tumblrette and turned off auto-posting of my Twitter stream. Hopefully I’ll now actually post things.

December 27, 2008

Sitting in Sanders Theatre waiting for the Christmas Revels to start. And it looks like Yo Yo Ma is in the audience!

December 25, 2008

Installing World of Warcraft on my laptop so I can get my present from Grandfather Winter later

Merry Christmas!