swift 判断应用是否第一次启动
2016-11-16 本文已影响0人
func_老衲姓罗
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// NSThread .sleepForTimeInterval(5.0)
self.window=UIWindow(frame:UIScreen.mainScreen().bounds)
print(NSUserDefaults.standardUserDefaults().boolForKey(LGFirstLaunch))
// 检测用户是不是第一次启动
if !NSUserDefaults.standardUserDefaults().boolForKey(LGFirstLaunch) {
// 是第一次启动
window?.rootViewController = GuideViewController()
NSUserDefaults.standardUserDefaults().setBool(true, forKey: LGFirstLaunch)
} else {
let tabBarController = RootTabbarController()
window?.rootViewController = tabBarController
}
window?.makeKeyAndVisible()
return true