0

I am making an iPhone app, and I want know how make a variable background image a background that the user can choose one of the options ?

Besi
  • 22,579
  • 24
  • 131
  • 223
João
  • 1
  • 1
  • 1
  • Duplicate http://stackoverflow.com/questions/224503/repeating-background-image-in-native-iphone-app – Besi Jan 23 '12 at 18:59

2 Answers2

8

I don't know what you want in the foreground, but anything based on the UIView class has a backgroundColor property that you can set to an image like this:

yourView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"YourImage.png"]];
Matthew Frederick
  • 22,245
  • 10
  • 71
  • 97
0

It didn't work for me, what it worked was:

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

I think is the same, but don't know why the other answer didn't work for me.

Hope it helps.

Shark Lasers
  • 441
  • 6
  • 15
larsnow
  • 25
  • 5