Mac Developer Library

Developer

AppKit Framework Reference NSPageController Class Reference

Options
Deployment Target:

On This Page
Language:

NSPageController

The NSPageController class is used for controlling swipe navigation and animations between views or view content. It is useful for user interfaces which control navigating multiple pages as in a book or a web browser history. More...

Inheritance


Conforms To


Import Statement


import AppKit @import AppKit;

Availability


Available in OS X v10.8 and later.
  • An array containing the objects displayed in the page controller’s view.

    Declaration

    Swift

    var arrangedObjects: [AnyObject]

    Objective-C

    @property(copy) NSArray *arrangedObjects

    Discussion

    The delegate will be asked for snapshots as they are needed. Alternatively, you may never directly set this array and use the -navigateForwardToObject: method to create a history as the user navigates.

    This property is key-value observing compliant.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.8 and later.

    See Also

    selectedIndex

  • Navigates to the specific object.

    Declaration

    Swift

    func navigateForwardToObject(_ object: AnyObject)

    Objective-C

    - (void)navigateForwardToObject:(id)object

    Parameters

    object

    The object to display.

    Discussion

    Clears the arrangedObjects array after the selected index, adds the argument to that array, and sets the selectedIndex to the object’s index.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.8 and later.

  • The currently selected object in the arranged objects array.

    Declaration

    Swift

    var selectedIndex: Int

    Objective-C

    @property NSInteger selectedIndex

    Discussion

    To animate a transition to a new index, use the NSPageController class animator object.

    This property is key-value observing compliant.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.8 and later.

    See Also

    arrangedObjects

  • delegate delegate Property

    The page controller’s delegate object.

    Declaration

    Swift

    @IBOutlet unowned(unsafe) var delegate: NSPageControllerDelegate?

    Objective-C

    @property(assign) IBOutlet id<NSPageControllerDelegate> delegate

    Discussion

    The delegate must conform to the NSPageControllerDelegate protocol.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.8 and later.

  • These constants control the transition style of the page controller.

    Declaration

    Swift

    enum NSPageControllerTransitionStyle : Int { case StackHistory case StackBook case HorizontalStrip }

    Objective-C

    enum { NSPageControllerTransitionStyleStackHistory, NSPageControllerTransitionStyleStackBook, NSPageControllerTransitionStyleHorizontalStrip } typedef NSInteger NSPageControllerTransitionStyle;

    Constants

    • StackHistory

      NSPageControllerTransitionStyleStackHistory

      Pages are stacked on top of each other. Pages animate out to the right to reveal the previous page. Next pages animate in from the right.

      Available in OS X v10.8 and later.

    • StackBook

      NSPageControllerTransitionStyleStackBook

      Pages are stacked on top of each other. Pages animate out to the left to reveal the next page. Previous pages animate in from the left.

      Available in OS X v10.8 and later.

    • HorizontalStrip

      NSPageControllerTransitionStyleHorizontalStrip

      Each page is laid out next to each other in one long horizontal strip

      Available in OS X v10.8 and later.

    Discussion

    These transition styles are independent of the delegate’s specification of book or history mode. It is perfectly reasonable to create a history style user interface using the book mode delegate methods. Simply set the transition style appropriately.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.8 and later.