Created
February 14, 2013 18:30
-
-
Save radex/4955049 to your computer and use it in GitHub Desktop.
Add that to a class that you want to use as a singleton object across multiple XIB files. If you have an init method, you might want to make sure you don't re-initialize the object that's already been initialized. Warning: feels like magic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (id) allocWithZone:(NSZone *)zone | |
{ | |
static id globalInstance; | |
if(!globalInstance) | |
{ | |
globalInstance = [super allocWithZone:zone]; | |
} | |
return globalInstance; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment