ios配置启动后的第一个页面(引导页或首页)

在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.
    }


}

 

然后运行就出现了黄色的页面 

 

posted @ 2017-05-25 10:46  牛郑焜  Views(2387)  Comments(0Edit  收藏  举报