我目前在formSheet样式中显示一个模态UIViewController,它与coverVertical动画一起呈现.我试图从它呈现另一个模态UIViewController,使用currentContext作为演示样式,flipHorizontal用于动画样式.它确实有效,但翻转后面有一个坚实的白色白色背景.有关如何使用formSheet样式中预先存在的模态UIViewController的flipHorizontal样式成功呈现另一个表单模式UIViewController的任何建议,请欣赏!谢谢
码:
// Loading of first modalVC
- (void)showModalVC {
Modal1VC *modal1VC = [[Modal1VC alloc] init];
modal1VC.modalPresentationStyle = UIModalPresentationFormSheet;
modal1VC.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:modal1VC animated:YES];
[modal1VC release];
modal1VC.view.superview.bounds = CGRectMake(0, 0, 400, 400);
}
// Loading of second modalVC in Modal1VC
- (void)buttonTapped:(id)sender {
UIViewController *modal2VC = [[UIViewController alloc] init];
modal2VC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
modal2VC.modalPresentationStyle = UIModalPresentationCurrentContext;
modal2VC.view.backgroundColor = [UIColor greenColor];
[self presentModalViewController:modal2VC animated:YES];
[modal2VC release];
modal2VC.view.superview.bounds = CGRectMake(0, 0, 400, 400);
}
Run Code Online (Sandbox Code Playgroud)
这似乎是 的限制presentModalViewController:animated:
。
[self presentModalViewController:modal2VC animated:YES]
您也许可以使用 UIView 动画来获得您想要的效果,而不是。也许是这样的:
[UIView transitionWithView:self.view.window
duration:0.3
options:UIViewAnimationOptionTransitionFlipFromRight
animations:^{
[self presentModalViewController:modal2VC animated:NO];
} completion:NULL];
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2957 次 |
最近记录: |