create constant.h NSObject file and define this color globally
#define globalColor [UIColor colorWithRed: (238.0f / 255.0f) green: (251.0f / 255.0f) blue: (255.0f / 255.0f) alpha: 0.8f];
and when you want to use it, just import the const file, another wise option 2 below.
Second option
in AppDelegate.h A simple file property synthesizes a single UIColor variable, as shown below.
@interface AppDelegate : UIResponder <UIApplicationDelegate>{
and synthesize the .m file as shown below.
@syntesize globalColor;
and in didFinishLaunchingWithOptions method just sets the color of this variable ..
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { globalColor = [UIColor colorWithRed:(238.0f/255.0f) green:(251.0f/255.0f) blue:(255.0f/255.0f) alpha:0.8f]; }
and if you want to use this color, use like this.
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; self.view.backgroundColor = appDelegate.globalColor;
source share