2

申し訳ありませんが、私はこれが初めてです。ページめくり効果のあるiPadアプリを作成しようとしています。私のアプリは横向きビューのみをサポートしており、デフォルトのページベースのアプリケーション プロジェクトで UIPageViewController をテストしています。すべて問題ないように見えますが、スパインを左側に配置して、各ページに 1 つの viewController (横向きであっても) のみを表示したいと考えています。私は試した

NSDictionary *options =  [NSDictionary dictionaryWithObject:
    [NSNumber numberWithInteger:UIPageViewControllerSpineLocationMin]
         forKey: UIPageViewControllerOptionSpineLocationKey];
self.pageViewController = [[UIPageViewController alloc] 
    initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl
    navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal 
    options:options];

しかし、背骨はまだ真ん中にあり、一度に 2 つのビュー コントローラーを表示しています... Web をいろいろ調べましたが、解決策が見つかりません。助けてください。

PSストーリーボードからPage View Controllerオブジェクトを使用する方法を知っている人はいますか? xcode の例でさえ、それを使用していません。

問題がどこにあるかを見つけました。rootViewController には、

- (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation

このメソッドは、spineLocation をオーバーライドします。すべてを削除して保持

UIViewController *currentViewController = [self.pageViewController.viewControllers objectAtIndex:0];
NSArray *viewControllers = [NSArray arrayWithObject:currentViewController];
[self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:NULL];

self.pageViewController.doubleSided = NO;
return UIPageViewControllerSpineLocationMin;

問題を解決します。

しかし、まだ疑問に思っています...ストーリーボードでUIPageViewControllerを実行する方法を整理できる人はいますか?

4

0 に答える 0