Reputation: 13942
How organize accessing to properties MyAppDelegate object for MyClass (ex: MyViewController). Can i directory get its from MyAppDelegate or i should pass it to init method as argument or other?
Upvotes: 0
Views: 1047
Reputation: 23510
It depends on what you want to do... Passing objects that are usefull for other classes is a good idea. But if you really want to access one of your AppDelegate property, define (for convenience) :
#define MY_APPDELEGATE ((YourAppDelegate*)[UIApplication sharedApplication].delegate)
Then access your property like this :
MY_APPDELEGATE.myproperty
Upvotes: 5