0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

UIPageViewControllerDataSource

Posted at

UIPageViewControllerDataSource

UIPageViewControllerDataSource Protocol Reference
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIPageViewControllerDataSourceProtocolRef/

The UIPageViewControllerDataSource protocol is adopted by an object that provides view controllers to the page view controller on an as-needed basis, in response to navigation gestures.

UIPageViewControllerDataSourceプロトコルはナビゲーションジェスチャーに応答してPageViewControllerにViewControllerを供給するオブジェクトに必要に応じて採用される。

The data source implementation is free to handle this responsibility in any way that is appropriate for your application. In many cases, it should look at the view controller passed to it, determine what content to display, and create the view controllers as they are needed. You may find it helpful to include information such as the page number in the view controller, to simplify the task of determining what content to display.

DataSourceの実装はアプリケーションによって任意に行うことができる
ViewControllerを受け取って表示するコンテンツを決定し、必要に合わせてViewControllerを作成する。
表示するコンテンツを決定する作業を簡素化するため、このようなViewControllerにページ番号のような情報を含めることができる

If both of the methods in Supporting a Page Indicator are implemented and the page view controller’s transition style is UIPageViewControllerTransitionStyleScroll, a page indicator is visible. Both of these methods are called after the setViewControllers:direction:animated:completion: method is called. After gesture-driven navigation, these methods are not called. The index is updated automatically and the number of view controllers is expected to remain constant.

Providing View Controllers

  • pageViewController(_:viewControllerBefore:) Required
  • pageViewController(_:viewControllerAfter:) Required

Supporting a Page Indicator

  • presentationCount(for:)
  • presentationIndex(for:)

example (Xcode>New>Project>Page-Based Application)

ModelController.swift

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?