How to create sharedInstance
of AppDelegate
and use in my Application anywhere.
Use like this:
In the AppDelegate.h
+ (AppDelegate *)sharedAppDelegate;
In AppDelegate.m
+ (AppDelegate *)sharedAppDelegate{
return (AppDelegate *)[UIApplication sharedApplication].delegate;
}
declare the statement in Constants.h
#define myappDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])
and you can use myappDelegate
any where in the app if you declare the Constants.h in .pch file
Check this for PCH for Xcode 6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With