简体   繁体   中英

How to add Page Control in watch application

I have seen several apps that is using page control to navigate among screens in watch application. But I wonder how can we add that control in watch interface. Please help.

Use WKInterfaceController.reloadRootPageControllers for this.

Here is example:

WKInterfaceController.reloadRootPageControllers(withNames: ["first", "second"], contexts: nil, orientation: .horizontal, pageIndex: 0)

Call this method to create or modify your app's page-based interface: At launch time. Use this method to customize the set of pages you want displayed, and to set the scrolling orientation. At runtime. Use this method to change the active set of pages or the orientation, adding or removing pages as needed.

NOTE: It's not recommended to uses both navigation types: pages and modal at the same time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM