Archive for November 2011

UIButtonTypeInfoLight masquerading as a UIBarButtonItem

Just in case you were wondering how to use a UIButtonTypeInfoLight (or UIButtonTypeInfoDark) as a UINavigationItem (a la UIBarButtonItem), here is what I threw together. Put this code in your view controller’s viewDidLoad method:

UIButton *button1 = [UIButton buttonWithType:UIButtonTypeInfoLight];
button1.frame = CGRectMake(0.0f, 0.0f, 40.0f, 32.0f);
[button1 addTarget:self action:@selector(aboutButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *aboutButton = [[UIBarButtonItem alloc] initWithCustomView:button1];
self.navigationItem.leftBarButtonItem = aboutButton;
[aboutButton release];

Adjust the frame to your taste, and supply the aboutButtonPressed method with an (id)sender parameter, and you are good to go.

Open Source iOS Projects (CIDUG meeting, November 22, 2011)

Thanks to everyone who turned out on Tuesday night for my CIDUG presentation on utilizing open source iOS projects. The presentation went a bit longer than I was hoping, largely due to the volume of demos that I had.

If you would like to download a PDF of the presentation, here is a link:

Open Source iOS Projects presentation

Also, if you would like to download a ZIP file of all of the demos that I did, here is a link for that:

Open Source iOS Projects demos

I realized this morning that what I should have done was to create a workspace, and then drag all of the individual projects into that one workspace for the demo. I have done this in the code that I uploaded, so when you unzip the demos file, just open the Demo projects.workspace file and then just use the Scheme selector at the top of the Xcode window to select which demo you want to look at or try out.

Please let me know if you have any questions or suggestions on the presentation or the demo code. I hope everyone out there has a safe and happy holiday season.


It has been a while since I have made a post, so I figured I would take this opportunity to point out that, if you are ever putting together a UITableViewCell (such as in the cellForRowAtIndexPath delegate method), there is a big difference between this:

cell.backgroundColor = [UIColor redColor];

And this:

cell.contentView.backgroundColor = [UIColor redColor];

Or, if you are creating an NSSortDescriptor, there is a big difference between this:

sortDesc = [[NSSortDescriptor alloc] initWithKey:@"sortOrder" ascending:YES];

And this:

sortDesc = [[NSSortDescriptor alloc] initWithKey:@"sortOrder" ascending:YES

Happy Nigel Tufnel day and Last Binary Day Of This Century (11/11/11) to everyone!