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])
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])
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:
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).