iphone - iPad : UIPageViewController navigationOrientation

标签 iphone objective-c ipad uipageviewcontroller

我希望在更改 UIViewController 的方向时更改 UIPageViewController 的导航方向。也就是说,当设备旋转到纵向时,我希望 navigationOrientationUIPageViewControllerNavigationOrientationVertical 更改为 UIPageViewControllerNavigationOrientationHorizo​​ntal

我尝试在 View Controller 旋转时设置 navigationOrientation 属性,但我发现 navigationOrientation 属性是只读的。

这是我想要的图片。

横向 View Landscape View

纵向 View enter image description here

我该怎么办?

最佳答案

好问题。

不知道为什么,但似乎 Apple 不希望您更改该属性。技术原因或某种 UI 指南。

无论如何,如果您不能更改方向,您应该采用不同的方法并使用两个 UIPageViewControllers,每个都有另一个导航方向,它们共享一个委托(delegate)。在设备转动时隐藏/显示相应的 View ,或者在每次设备转动时初始化/释放一个新对象。

顺便说一句。您是否看过委托(delegate)的 pageViewController:spineLocationForInterfaceOrientation: 方法。似乎 Apple 对设备方向变化使用react的首选方式是这种方式:

Discussion Use this method to change the spine location when the device orientation changes, as well as setting new view controllers and changing the double-sided state.

This method is called only if the transition style is UIPageViewControllerTransitionStylePageCurl.

请注意,Apple 的日历应用程序的纵向页面非常纤细 - 似乎确实是他们的 UI 理念。

关于iphone - iPad : UIPageViewController navigationOrientation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10430083/

相关文章:

iphone - 如何读取目录的文件?

iphone - "Plays Sound"Interface Builder 中 UIButton 的属性

ipad - MFMailComposeViewController-iPad

android - 有谁知道用 emo-framework 开发的游戏吗?

iPhone 和 Ipad - 如何获取代码?

iphone - CCSprite 遵循一系列 CGPoints

ios - Objective-C 使 vc1 的 UITextField 成为 UILabel vc2

iphone - GestureRecogniser 并禁用 UIScrollView 中 UIView 的拖动手势

iphone - 你能从值中获取 NSDictionary 键吗

iphone - 如果条件不工作则赋值