Set background image in iphone

Can I set an image for my own background image? I do not want to use the UIImageView control. It seems that this cannot be done using IB. Should I do this programmatically?

Thank.

+3
source share
5 answers

What a waste of resources, use:

[[self view] setBackgroundColor: [UIColor colorWithPatternImage: [UIImage imageNamed:@"background.png"]]];
+9
source
self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"plain_bg.png"]];
+1
source

UIImageView? .

0

, backgroundColor - -. UIImageView .

0
UIColor *background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"pic.png"]];
self.view.backgroundColor = background;

0

Source: https://habr.com/ru/post/1726631/


All Articles