node ninja
node ninja

Reputation: 32996

How to change background color in iPhone app

I tried this code in the view controller, but it didn't work. Why is that?

- (void)viewDidLoad {
 [self setBackgroundColor:[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0]];
    [super viewDidLoad];
}

Upvotes: 0

Views: 5116

Answers (1)

Vladimir
Vladimir

Reputation: 170849

You should set background color to the view, not to its controller:

[self.view setBackgroundColor:[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0]];

Upvotes: 5

Related Questions