在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. } }
然后运行就出现了黄色的页面