Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set background image for entire iPhone / iPad app

I have a single image I want as the background for my app no matter what viewcontroller they are on - how do you accomplish this?

like image 227
Slee Avatar asked Feb 06 '11 19:02

Slee


People also ask

How do I set the whole picture as my wallpaper on my iPhone?

Start the Settings app and tap "Wallpaper." Tap "Choose a new wallpaper" and select the screenshot of your photo. You'll be able to include the entire photo from side to side, with black bars at the top and bottom.

How can I put a whole picture as my background?

Tip: touch and hold the empty space on your home screen and select Wallpaper at the bottom to reach the wallpaper setting screen. Pick the image you want to use as your background. Once your image (portrait or landscape) is selected, you will see a preview of your wallpaper filling up your whole screen.


1 Answers

Here's how you set a background to an image:

self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Background.png"]]; 

Edit: To write up what Felixyz said (and thanks to Manni), do this in your delegate:

window.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Background.png"]]; 

And in each view you want to have the image, do this:

self.view.backgroundColor = [UIColor clearColor]; 
like image 153
sudo rm -rf Avatar answered Sep 21 '22 15:09

sudo rm -rf