在另一个UIViewController之上呈现模糊的UIViewController

时间:2016-04-08 13:12:40

标签: ios objective-c iphone cocoa-touch uiview

我有2个VC - firstVCsecondVCsecondVC的视图颜色为clear color,其视图为UIVisualEffect,模糊不清。

我想在secondVC上以firstVC模式提出firstVC,但当我这样做时,p.layout.margin = struct('b', 15,'l', 30, 'r', 0, 't', 0); 会变黑。

谢谢

2 个答案:

答案 0 :(得分:1)

如果ios版本> = 8.0则

 SecondViewController.modalPresentationStyle = UIModalPresentationOverCurrentContext;
[self presentViewController:SecondViewController animated:YES completion:nil];

如果使用ios7&导航控制器然后

 self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:SecondViewController animated:YES completion:nil];

如果没有导航控制器那么

 self.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:SecondViewController animated:YES completion:nil];

答案 1 :(得分:1)

您需要在呈现的(secondVC)控制器上正确设置modalPresentationStyle

UIModalPresentationOverFullScreenUIModalPresentationOverCurrentContext将提供第二个VC内容超过第一个VC顶部的效果。