Reputation: 1287
I need to set my background of viewcontroller to an image. AFTER reading other SO answers I see that we should put code:
[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"login_page_bg.png"]]]
into viewDidLoad
I did this but still get white background. My login_page_bg.png is inside the same folder where my XYZLoginPageViewController.m is. What am I doing wrong?
Upvotes: 0
Views: 71
Reputation: 23407
Take imageview on view .
UIImageView *bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"background-image"]];
bgImageView.frame = self.view.bounds;
[self.view addSubview:bgImageView];
[self.view sendSubviewToBack:bgImageView];
Upvotes: 2