2

Im currently stylizing my login screen of my app, but I am running into a problem that i can't solve and is very odd... The image is not resizing properly and kind of starts to repeat itself, which i find very weird because i have the correct image sizes and have them correctly named, and i am calling them in my code correctly too, so i cannot find my problem. Below is the code.

    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"sl_login_default"]];
  • Answer - https://stackoverflow.com/questions/8077740/how-to-fill-background-image-of-an-uiview/45299727#45299727 – Jack Jul 25 '17 at 09:52

1 Answers1

1

colorWithPattern is meant to create a pattern out of an image. If you want to have an image in the background, create a new UIImageView

UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName];
backgroundImageView.frame = self.view.bounds;
[self.view addSubview:backgroundImageView];
rounak
  • 9,217
  • 3
  • 42
  • 59
  • I knew i coudl do that but i didn't want to... and by the way that still doesn't fix the problem the picture does not fit the screen it is still a little small, but the weird thing is the picture is the right dimensions and everything – user2464778 Apr 05 '14 at 18:40
  • try setting the `contentMode` of the imageview – rounak Apr 05 '14 at 18:42
  • Ok so the problem is not the resizing of the image apparently, its just not using the other dimensions, like its only using the 320 x 640 image that i have – user2464778 Apr 05 '14 at 18:46
  • apparently it was getting confused with the 320 x 640 image and was only using that, but when i deleted and made the iphone 4 image the default it works for both iphone 4 and iphone 5. Thanks – user2464778 Apr 05 '14 at 18:53