iPhone 5 に対応するようにアプリを更新するときに、同じ問題に対処する必要がありました。iOS 6 SDK でコンパイルすると、問題は iOS 6 で発生しますが、iOS 5 では発生しません。これは、PageViewController を横方向から入力した場合にのみ発生します。
回避策:
.m の @interface セクションに現在の状態を保存するプロパティを作成します。
@property (strong, nonatomic) NSArray *viewControllersSave;
viewController を次の場所に保存しますwillRotateToInterfaceOrientation
。
(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
// some code here...
self.viewControllersSave = self.pageViewController.viewControllers;
}
の PageViewController プロパティの代わりに、保存されたプロパティを使用しますspineLocationForInterfaceOrientation
。
- (UIPageViewControllerSpineLocation)pageViewController: (UIPageViewController *)pageViewController
spineLocationForInterfaceOrientation: (UIInterfaceOrientation)orientation
{
// some code
NSArray *viewControllers = @[self.viewControllersSave[0]];
[self.pageViewController setViewControllers:viewControllers
direction:UIPageViewControllerNavigationDirectionForward
animated:YES
completion:NULL];
return UIPageViewControllerSpineLocationMin;
}
これは問題を回避する可能性がありますが、後で使用するためにそのような回避策を回避するために、Apple にバグ レポートを送信する必要があります。