APP自定义广告页、启动页、欢迎页等技巧

像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()

}

}

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容