13

I've just created a new view based application, and now I want to set the background color at the application startup rather then in IB. I have found this code in a tutorial:

UIView *view = [[UIView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
[view setBackgroundColor:[UIColor greenColor]];

But my view is still white.

How do I make it work?

Thanks in advance.

1 Answer 1

6

This should work. Are you adding the view to the window using addSubView ?

1
  • Thanks, I added the code to the appDidFinishLaunching method with viewController.view setBackgroundCollor.... etc...
    – user142019
    Sep 7, 2009 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.