【问题标题】:iOS only rotate one of the childviewcontrollersiOS 仅旋转其中一个 childviewcontrollers
【发布时间】:2016-05-24 08:27:14
【问题描述】:

是否可以只旋转其中一个子vc?

xamarin 代码(和 swift 差不多)

mainVC.addChildViewController(childVC_A);
mainVC.addChildViewController(childVC_B);
mainVC.addSubView(childVC_A.View);
mainVC.addSubView(childVC_B.View);

mainVC 使 shouldAutorotate 为真,GetSupportedInterfaceOrientations 返回所有方向;

我只希望 childVC_A 自动旋转到横向模式,而 childVC_B 始终保持纵向模式。

childVC_A 具有 shouldAutorotatetrueGetSupportedInterfaceOrientations 以返回所有方向;

childVC_B 具有 shouldAutorotatefalseGetSupportedInterfaceOrientations 以仅返回纵向;

这可能吗?

【问题讨论】:

    标签: ios swift xamarin uiviewcontroller


    【解决方案1】:

    我不能谈论 Xamarin 的细节,但通常不可能使用系统旋转机制来旋转屏幕的一部分而不是另一部分(也很难做像只旋转一个UITabController 的标签有效)。您或多或少地陷入了与加速度计 (CoreLocation) 的挂钩并自行实现部分旋转。

    【讨论】:

    • 有没有办法强制子视图/vc 像旋转到横向一样布局?
    • @zaftcoAgeiha 您可以设置视图控制器视图的transform 属性以应用旋转,是的。当然,您可以在 the documentation 中了解该属性。
    猜你喜欢
    • 1970-01-01
    • 2015-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多