Domanda

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"]];
È stato utile?

Soluzione

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];
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top