Sunday, October 11, 2009

iPhone dev Stupidity 60: Global object lives in NIB

Global object doesn't have a good place to live - you can use singleton.

You can also setup a slot in interface builder for it. 

In my project, I add an IBOutlet for TemplateDB (the sqlite3 wrapper) in Category View Controller.

The pro of this way is that you don't need to write extra code to insure there's only one instance. And the link is set up in interface builder - which means it's kind of data.

No comments: