像APP啟動頁癣蟋、廣告頁的切換模式最好使用通知,并且在使用通知的時候狰闪,比較好的做法是在appdelegate中添加action疯搅,在action中可以根據(jù)傳入的notification.name來判斷通知的內容;eg:
//-通知響應
func showMainTabBarVC(noteInfo: NSNotification){
ifnoteInfo.name== GuideViewControllerDidFinish{
UIApplication.sharedApplication().setStatusBarHidden(false, withAnimation: UIStatusBarAnimation.Fade)
self.window?.rootViewController = HEMainTabBarController()
}else ifnoteInfo.name== ADImageLoadFinished{
if let image = noteInfo.userInfo?["image"] as? UIImage{
let vc = HEMainTabBarController()
vc.adImage = image
self.window?.rootViewController = vc
}else{ //廣告加載失敗了
self.window?.rootViewController = HEMainTabBarController()
}
}
}