Creating string enumerations in Objective-C (The ultimate solution)

A while ago I wrote on my blog about a solution to one of the most common questions asked by Objective-C programmers which is “How can I create string enumerations?”. Well, the solution that I’ve given has immediately become one of the top subjects that attracts developers to my blog, as I can see in my stats. I thought I should now take it to a whole other level and get rid of the limitations that I had presented in the old solution, and come up with a fresh perspective.

The following video is the result of my work on this subject. I hope you’ll enjoy watching it.

Git Repositories for 4 of My Books

I have set up 4 GitHub repositories for my four books:

iOS 4 Programming Cookbook

Concurrent Programming in Mac OS X and iOS

Writing Game Center Apps in iOS

Graphics and Animation on iOS

Enjoy 🙂

Xcode 4 Refactoring Features – Part 1

In this video, you will learn about Rename, Extract, Create Superclass, and Move Up refactoring facilities in Xcode 4, Apple’s latest and greatest development environment for iOS and Mac OS X. If you have any questions, or comments, leave them down here.

Animations in iOS Using Block Objects (Video, Part 2)

After learning simple block object animations in iOS in the previous video, you will now learn how to use more complicated block based animations that take advantage of “completion” block objects to notify you of the completion of an animation block.

To learn more about graphics and animation in iOS, refer to Graphics and Animation on iOS (an O’Reilly book)

Animations in iOS Using Block Objects (Video, Part 1)

In this video, you will learn how to use the new block-based animations in the UIView class in iOS to create animations in your iOS apps.

To learn more about graphics and animation in iOS, refer to Graphics and Animation on iOS (an O’Reilly book)

DocBook Video Tutorial 2 – DocBook to PDF with Xcode and XMLLINT

In this tutorial you will learn:

  1. Downloading DocBook Documentation
  2. Writing DocBook in Xcode
  3. Validating DocBook XMLs
  4. Generating PDF from DocBook XMLs

To download MacPorts, go to:

To install XMLLINT categories, use this Terminal command:

sudo port install docbook-xml xmlcatmgr

To validate a DocBook XML, place these commands (as demonstrated in the video) into an executable file and run by passing the name of the file to validate as an argument:


export SGML_CATALOG_FILES=/opt/local/etc/xml/catalog

xmllint –valid –noout –catalogs $fileToValidate

Questions? let me know and watch for the next videos about DocBook

Loading a Nib file, Programmatically (Objective-C)

If you want to load a Nib file at run time by simply allocating and initializing a View object, then you should take a rather strange approach to how you create your class files. Suppose you have a subclass of UIView called MyView and what you want is to allocate and initialize an instance of MyView but have MyView load its outlets and actions from a Nib file. Well, you will need to do two things:

  1. In Interface Builder, change the class name of your View object to MyView.
  2. Then you will have to override MyView’s initWithFrame method like so:

- (id)initWithFrame:(CGRect)paramFrame

NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"MyView"

if ([arrayOfViews count] < 1){
[self release];
return nil;

MyView *newView = [[arrayOfViews objectAtIndex:0] retain];
[newView setFrame:paramFrame];

[self release];
self = newView;

return self;



Then you can go ahead and initialize your view like this:

MyView *myView = [[MyView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:myView];
[myView release];

And here an instance of MyView will get added to the view of a view controller. That simple. I hope it helps some of you out there 🙂

Easter Egg in GarageBand for iPad (Curtain-Call demo song)

So after reading how cool GarageBand was (which it truly is) for iPad, I purchased it the other day. I got a few crashes after using it for a long time. I think some memory warnings, because I am running it on the original iPad rather than iPad 2.

When you open the app, you can start composing music. But what got my attention was that there is a little “secret” demo song that gets shipped with GarageBand for iPad and it’s called Curtain-Call. Why is it secret? Because it won’t appear on your iPad’s GarageBand unless it has crashed at least once!

That sounds weird, doesn’t it. But if you can, get GarageBand to crash once on your iPad. Then open it again and in your library of songs, you should see a new song called Curtain Call, it’s amazing. It looks like Apple has put this as an easter egg in GarageBand (that’s so unlike Apple though). Check out the screen shots that I’ve taken of my GarageBand on iPad. Do you have this song in your GarageBand library on the iPad?

I have also attached the song to the end of this post, if you want to just listen to it. It really sounds cool knowing that it has been composed entirely on an iPad with GarageBand!

Curtain Call, GarageBand Demo Song (Easter Egg)



Curtain Call 8 Track

Curtain Call iPad Demo Song for Garage Band