UIViewController* transparentView = [[UIViewController alloc] init];

UIViewController* controller = self.view.window.rootViewController;

transparentView.view.backgroundColor = [UIColor blackColor];

transparentView.view.alpha = 0.5f;

controller.modalPresentationStyle = UIModalPresentationCurrentContext;

[controller presentModalViewController:transparentView animated:YES];

其要点就是使用iOS特有的rootViewController来显示Modal View

相关文章: