[英]Black screen when presenting view controller
I have draw a view inside my storyboard that have 300x350 pixels, I want to present this view inside my current view (600x600 pixels and is a initial view controller), for this I try this code: 我在情节提要板中绘制了一个300x350像素的视图,我想在当前视图(600x600像素,是初始视图控制器)中显示此视图,为此,我尝试以下代码:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ModalViewController *viewController = (ModalViewController *)[storyboard instantiateViewControllerWithIdentifier:@"modalView"];
viewController.modalPresentationStyle = UIModalPresentationCurrentContext;
viewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:viewController animated:YES completion:^{
viewController.view.superview.frame = CGRectMake(0, 0, 300, 350);
viewController.view.superview.center = self.backgroundColorView.center;
}];
This code have two problems: 此代码有两个问题:
How can I solve this problem? 我怎么解决这个问题? (I'm not using navigation controller) (我没有使用导航控制器)
您需要将modalPresentationStyle更改为overCurrentContex
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.