为整个iPhone / iPad应用设置背景图像

为整个iPhone / iPad应用设置背景图像

问题描述:

我想要一个我想作为我的应用程序的背景的图像,无论它们在哪个视图控制器上 - 你如何实现这个目标?

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?

以下是设置图像背景的方法:

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

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






编辑到写下Felixyz所说的内容(感谢Manni),在你的代表中这样做:


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

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

在每个视图中,您想拥有图片,请执行以下操作:

self.view.backgroundColor = [UIColor clearColor];