我在故事板中绘制了一个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;
}];
此代码有两个问题:
我该如何解决这个问题? (我没有使用导航控制器)
答案 0 :(得分:2)
您需要将modalPresentationStyle更改为overCurrentContex