Reputation: 11
mac os: 10.10 xcode:6.1
I got a "default cocoa program" by Xcode. and I want to change the window color...after researching, I did the following code in AppDelegate.m:
NSWindow *myWindow;
NSColor *semiTransparentBlue =
[NSColor colorWithDeviceRed:0.0 green:0.0 blue:1.0 alpha:0.5];
[myWindow setBackgroundColor:semiTransparentBlue];
but window color not changed...
1: how to change the window color on mac os? 2: no NSWindow in "Default cocoa program" by Xcode, why will get a window?
thank your very much.
i tried some functions...but failed..following is the detail:
(void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application
//compile success but the window's color is not changed. [[NSApplication sharedApplication] keyWindow].backgroundColor = [NSColor redColor];
//or the following two got compiled error self.view.backgroundColor = [UIColor redColor]; self.window.backgroundColor = [UIColor redColor];
}
Upvotes: 1
Views: 2213
Reputation: 213
in your app delegate juste type this :
self.window.backgroundColor = [NSColor whiteColor];
Upvotes: 0