views:

2754

answers:

1

Hi all!

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  A: 

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

Philippe Leybaert
Thanks, I added the code to the appDidFinishLaunching method with viewController.view setBackgroundCollor.... etc...
Time Machine