標籤:key sources with 內容 mem err cal 簡單 啟動
在AppDelegate.swift中配置ViewController.swift為啟動後的第一個頁面
import UIKit@UIApplicationMainclass AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // 啟動後的第一個頁面 self.window = UIWindow(frame: UIScreen.mainScreen().bounds); // 這裡設定rootViewController為ViewController執行個體 let vc = ViewController(); self.window?.rootViewController = vc;//本行vc處填寫你要選擇的頁面 self.window?.backgroundColor = .whiteColor(); self.window?.makeKeyAndVisible(); return true; }
在ViewController.swift中簡單寫一下背景色
import UIKitclass ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. self.view.backgroundColor = .yellowColor();//背景色的設定 } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. }}
選擇相應【TARGETS】,選擇【General】,找到如下兩個配置項,並清空內容。
刪除Main.storyboard和LaunchScreen.storyboard檔案。
然後運行就出現了黃色的頁面
ios配置啟動後的第一個頁面