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]; }]; }
主要代码:
vc.modalPresentationStyle = UIModalPresentationCustom;