Reputation: 3230
I read a post to use macro to reference AppDelegate. I wonder what I should use to replace (MyOwnAppDelegate*)
#define AppDelegate ((MyOwnAppDelegate*)[[UIApplication sharedApplication] delegate])
Upvotes: 0
Views: 688
Reputation: 299305
If you're referencing the UIApplicationDelegate
so often that you need a special macro for it, then you're referencing it too often. The application delegate is the delegate of the main UIApplication
object. It is not a general place to store "stuff." See the following discussions:
Upvotes: 3
Reputation: 40211
If it's a more recently started project, your delegate is probably called AppDelegate
. To find out, you have to find the class in your project that implements NSApplicationDelegate
or UIApplicationDelegate
(depending on your target platform).
Upvotes: 2