IOS8及以上,设置
nextVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
IOS8以下,设置
self.modalPresentationStyle = UIModalPresentationCurrentContext;
其中 nextVC 是要显示的ViewController, self是当前ViewController。
全部代码如下:
nextVC.view.backgroundColor = [UIColor clearColor];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
nextVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
} else {
self.modalPresentationStyle = UIModalPresentationCurrentContext;
}
[self presentViewController:nextVC animated:YES completion:nil];