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


}

 

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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM