在AppDelegate.swift中配置ViewController.swift為啟動后的第一個頁面
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// 啟動后的第一個頁面
self.window = UIWindow(frame: UIScreen.mainScreen().bounds);
// //跳轉到無導航欄的ViewController()
// let vc = ViewController();
// window?.rootViewController = vc;//本行vc處填寫你要選擇的頁面
// window?.makeKeyAndVisible();
//跳轉到有導航欄的ViewController()
let mvc = UINavigationController(rootViewController: ViewController())
window?.rootViewController = mvc
window?.makeKeyAndVisible()
return true;
}
在ViewController.swift中簡單寫一下背景色
import UIKit
class 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.
}
}
然后運行就出現了黃色的頁面
