【发布时间】:2016-03-13 22:30:04
【问题描述】:
我已经在我的故事板中绘制了一个 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;
}];
这段代码有两个问题:
- 我的视图以全屏方式加载,并有延迟将屏幕尺寸更改为 300x350 像素。
- 在我的视图之外我可以看到一个黑屏(在我的情况下应该出现在我的另一个视图的一部分)。
我该如何解决这个问题? (我没有使用导航控制器)
【问题讨论】:
标签: ios objective-c uiview uiviewcontroller