Ivá*_*lta 3 objective-c ipad modalviewcontroller uimodalpresentationstyle
我们的iPad版本存在下一个问题.
我在UITabBar中有一个NavigationController.我希望显示一个外观和感觉类似于电子邮件表单的表单.
我使用相同的代码来显示模型居中:
// View to be displayed in the modal
AdhocViewController *controller = [[AdhocViewController alloc] initWithNibName:@"AdhocViewController" bundle:[NSBundle mainBundle]];
controller.caller = self;
// The form will need a navigation bar to cancel or save the form
UINavigationController *modalViewNavController = [[UINavigationController alloc]
initWithRootViewController:controller];
// Configurate the modal presentation and transition
modalViewNavController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
modalViewNavController.modalPresentationStyle = UIModalPresentationFormSheet;
// Show the new view
[self presentModalViewController:modalViewNavController animated:YES];
Run Code Online (Sandbox Code Playgroud)
此代码在纵向模式下完美运行,但在横向上,视图部分显示在屏幕外...我还没有找到解决它的方法.
我测试了一些我在这里找到的解决方案......
并在预设模型视图后尝试添加下一行以调整其大小,但不能解决问题
controller.view.superview.frame = CGRectMake(0, 0, 600, 700);
controller.view.superview.center = self.view.center;
Run Code Online (Sandbox Code Playgroud)
有什么建议吗?
谢谢,
伊万
StackOverflow中的引用:
使用iOS7,技巧是将modalTransitionStyle设置为UIModalTransitionCrossDissolve.
UIViewController *viewController = [[UIViewController alloc] init];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
navigationController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:navigationController animated:YES completion:nil];
navigationController.view.superview.frame = CGRectMake(0, 0, 800, 544);
navigationController.view.superview.center = self.view.center;
Run Code Online (Sandbox Code Playgroud)
https://coderwall.com/p/vebqaq
| 归档时间: |
|
| 查看次数: |
5259 次 |
| 最近记录: |