【问题标题】:Present a modal landscape View Controller from a portrait View Controller从纵向视图控制器呈现模态横向视图控制器
【发布时间】:2012-06-18 16:32:10
【问题描述】:

我有一个只有肖像的 VC,它呈现了一个只有风景的 VC。我正在努力看看如何让它发挥作用。在模态 VC 呈现后调用动画旋转模态 VC 时我有一些运气,但这看起来有点狡猾。

我坚持使用 iOS 4.3,所以没有故事板。

我想要的是……

[landscapeVC setOrentation:UIDeviceOrentaionLanscape];
[portraitVC presentModalViewController:landscapeVC Animated:YES];

感谢您的帮助

【问题讨论】:

    标签: ios ios4 uiviewcontroller modalviewcontroller


    【解决方案1】:

    在 PortraitVC 的 viewDidLoad 方法和 shouldautorotate 方法中使用这个:

     [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
     [[self view] setBounds:CGRectMake(0, 0, 480, 320)];
     [[self view] setCenter:CGPointMake(160, 240)];
     [[self view] setTransform:CGAffineTransformMakeRotation(M_PI / 2)];
    

    【讨论】:

    • 经过几次测试,事实证明这两个 VC 都嵌套在另一个锁定为纵向的 VC 中。不知道我能不能在主VC上调用“shouldAutorotateToInterfaceOrientation...”方法?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-21
    • 1970-01-01
    • 2011-09-27
    • 2012-10-11
    • 1970-01-01
    • 2013-01-15
    • 1970-01-01
    相关资源
    最近更新 更多