像APP启动页、广告页的切换模式最好使用通知,并且在使用通知的时候,比较好的做法是在appdelegate中添加action,在action中可以根据传入的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()
}
}
}