0
我有一个PageViewController有3次呈现的应用,最后一页我有我的TabBarViewController链接的按钮。
我想只为第一次启动,我的3个演示视图,然后为下一个启动,直接启动我的TabBarViewController。PageViewController(应用演示)首次推出接着tabBarViewController,斯威夫特
我该怎么办呢?
谢谢!
我有一个PageViewController有3次呈现的应用,最后一页我有我的TabBarViewController链接的按钮。
我想只为第一次启动,我的3个演示视图,然后为下一个启动,直接启动我的TabBarViewController。PageViewController(应用演示)首次推出接着tabBarViewController,斯威夫特
我该怎么办呢?
谢谢!
编辑
tabBarController:
required init(coder aDecoder: NSCoder)
{
super.init(coder: aDecoder)!
}
页面访问量和TabBar之间按钮:
@IBAction func firstTime() {
NSUserDefaults.standardUserDefaults().setBool(true, forKey: "hasAppBeenLaunchedBefore")
print(true)
}
的AppDelegate:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
didFinishLaunchingOnce()
return true
}
func didFinishLaunchingOnce() -> Bool
{
let defaults = NSUserDefaults.standardUserDefaults()
if let hasBeenLauncherBefore = defaults.stringForKey("hasAppBeenLaunchedBefore")
{
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
var exampleViewController: TabBarViewController = mainStoryboard.instantiateViewControllerWithIdentifier("TabBarViewController") as! TabBarViewController
self.window?.rootViewController = exampleViewController
self.window?.makeKeyAndVisible()
//print(" N-th time app launched ")
return true
}
else
{
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
var exampleViewController: OnboardingPager = mainStoryboard.instantiateViewControllerWithIdentifier("OnboardingPager") as! OnboardingPager
self.window?.rootViewController = exampleViewController
self.window?.makeKeyAndVisible()
//print(" First time app launched ")
defaults.setBool(true, forKey: "hasAppBeenLaunchedBefore")
return false
}
}
享受