大佬教程收集整理的这篇文章主要介绍了iOS 6:父模态的modalPresentationStyle旋转后忽略,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
所以这是如何创建和呈现第一模态:
UINavigationController *navigationController = [[[UINavigationController alloc] initWithRootViewController:controller] autorelease]; navigationController.modalPresentationStyle = UIModalPresentationFormSheet; [parentController presentModalViewController:navigationController animated:YES]; // parentController is my application's root controller@H_801_11@这是如何创建和呈现子模式:
UINavigationController *navigationController = [[[UINavigationController alloc] initWithRootViewController:controller] autorelease]; navigationController.modalPresentationStyle = UIModalPresentationFormSheet; [parentController presentModalViewController:navigationController animated:YES]; // parentController is the navigationController from above@H_801_11@因此,当从横向旋转到纵向时,父模式将扩展到全屏,并保持那种方式,即使我们旋转回到风景。
当我们有父模态所有(没有孩子模式),然后它的工作原理,这是它保持在表单工作表样式。
注意,这只发生在iOS6(设备和模拟器),并不会发生在iOS 5(模拟器,并报告由测试人员工作)。
到目前为止,我试过以下没有成功:
>将wantsFullScreenLayout设置为NO
>强制wantFullScreenLayout总是通过覆盖它返回NO
>使某些我的控制器在导航控制器内也指定UIModalPresentationFormSheet
>实现preferredInterfaceOrientationForPresentation
>升级到iOS 6.0.1谢谢!
更新:
所以,我适应了苹果开发者论坛(https://devforums.apple.com/message/748486#748486)的响应,使其适用于多个嵌套模态。
- (BOOL) neednestedModalHack { return [UIDevice currentDevice].sy@L_262_6@Version.floatValue >= 6; } - (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { // We are the top modal,make to sure that parent modals use our size if (self.neednestedModalHack && self.presentedViewController == nil && self.presenTingViewController) { for (UIViewController* parent = self.presenTingViewController; parent.presenTingViewController; parent = parent.presenTingViewController) { parent.view.superview.frame = parent.presentedViewController.view.superview.frame; } } [super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration]; } - (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { // We are the top modal,make to sure that parent modals are hidden during transition if (self.neednestedModalHack && self.presentedViewController == nil && self.presenTingViewController) { for (UIViewController* parent = self.presenTingViewController; parent.presenTingViewController; parent = parent.presenTingViewController) { parent.view.superview.hidden = YES; } } [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; } - (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { // We are the top modal,make to sure that parent modals are shown after animation if (self.neednestedModalHack && self.presentedViewController == nil && self.presenTingViewController) { for (UIViewController* parent = self.presenTingViewController; parent.presenTingViewController; parent = parent.presenTingViewController) { parent.view.superview.hidden = NO; } } [super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; }@H_801_11@
以上是大佬教程为你收集整理的iOS 6:父模态的modalPresentationStyle旋转后忽略全部内容,希望文章能够帮你解决iOS 6:父模态的modalPresentationStyle旋转后忽略所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。