Sets the view controllers to be displayed.
SDKs
- iOS 5.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
Framework
- UIKit
Declaration
- (void)setViewControllers:(NSArray<UIView Controller *> *)viewControllers direction:(UIPage View Controller Navigation Direction)direction animated:(BOOL)animated completion:(void (^)(BOOL finished))completion;
Parameters
viewControllers
The view controller or view controllers to be displayed.
direction
The navigation direction.
animated
A Boolean value that indicates whether the transition is to be animated.
completion
A block to be called when the page-turn animation completes.
The block takes the following parameters:
- finished
YES
if the animation finished;NO
if it was skipped.
Discussion
The view controllers passed to this method are those that will be visible after the animation has completed. Use a data source to provide additional view controllers to which users navigate.
If the transition style is UIPage
, the view controllers to pass in the view
parameter depends on the spine location and the value of the double
property:
Spine location | Double sided | What to pass |
---|---|---|
|
| Pass the page to be displayed on the left and the page to be displayed on the right. |
|
| Pass the front of the page to be displayed and the back of the previously-displayed page. The back is used for the page turning animation. |
|
| Pass the front of the page to be displayed. |