present一个半透明的ViewController的方法
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了present一个半透明的ViewController的方法相关的知识,希望对你有一定的参考价值。
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;
以上是关于present一个半透明的ViewController的方法的主要内容,如果未能解决你的问题,请参考以下文章