最簡單的方法是將一個UIImageView
添加到您的根窗口,並確保您的所有其他意見有透明的背景;
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let window=self.window!
let backgroundView=UIImageView(frame: window.frame)
backgroundView.image=UIImage(named: "Background.JPG")!
window.addSubview(backgroundView)
return true
}
或在Objective-C
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
UIWindow *window=application.windows.firstObject;
UIImageView *imageView=[[UIImageView alloc] initWithFrame:window.frame];
imageView.image=[UIImage imageNamed:@"Background.jpg"];
[window addSubview:imageView];
return YES;
}
我相信這抽我的記憶很好,但我會接受它在其他選項 –
@EricJohnson您可以創建背景baseViewController並繼承了所有的ViewController從該baseViewController – HardikDG
transperant顏色這將導致一致的背景,但由於每個視圖控制器有它自己的背景圖像,圖像仍然會在視圖控制器轉換期間移動。 – Paulw11