起因
需求需要做一個(gè)引導(dǎo)頁面,這個(gè)引導(dǎo)頁的邏輯處理較多喉恋,如果單獨(dú)一個(gè)View,不方便管理與后期的維護(hù)绍坝,所以需要做成ViewController來管理和維護(hù)
下面直接分享一下我的源碼
RecommandViewController *recommandVC = [[RecommandViewController alloc]init];
if([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0){
recommandVC.modalPresentationStyle=
UIModalPresentationOverCurrentContext|UIModalPresentationFullScreen;//if the controller has container like navigationcontroller or tababr controlelr,if you don`t use the UIModalPresentationFullScreen the bar will cover the viewcontroller
[FindAppDelegate().window.rootViewController presentViewController:recommandVC animated:NO completion:^{
recommandVC.view.backgroundColor=[UIColor clearColor];//you can figure any transparent here
}];
}else{
FindAppDelegate().window.rootViewController.modalPresentationStyle=
UIModalPresentationCurrentContext|UIModalPresentationFullScreen;//you must use the rootViewController if the system version under the iso 8.0 or the background will be black
[FindAppDelegate().window.rootViewController presentViewController:recommandVC animated:YES completion:^{
recommandVC.view.backgroundColor=[UIColor clearColor];
}];
}