Recently, the Apple prostitute listing, fruit also released Xcode 6.2 official version, WatchKit can also be used normally. The fruit is in time to provide the development documentation for Apple Watch, and I'm also trying to wildest learn to develop watch apps.
Today the main want to talk about is the Watch app page navigation mode, this piece of content and the normal development of iOS, it is worth exploring.
Page type
According to the official documentation, the Watch app is available in only two page formats: page Based and hierarchical. these two forms of navigation cannot coexist directly, but coexistence can be achieved by Modalpage (modal pages), as shown below .
Page Based pages are similar to the pagination layout in iOS general development, and can be left-and-right to toggle pages, belonging to sibling navigation, and is suitable for situations where each page data is not associated with another page, as follows:
The hierarchical page is basically consistent with push navigation in regular iOS development, enabling hierarchical navigation for more complex data models or apps with multi-layered data, with the following effects:
The Modal page can be implemented with page based pages and hierarchical pages, which are essentially the same as the modal navigation in regular iOS development, with the following effects:
So what's the problem, and how do they make it?
- Implemented in the designer
The implementation of the designer is very simple, consistent with regular iOS development, using the control+ mouse drag-and-drop form, the effect is as follows:
2. Code Control implementation
Of course, the use of code can also implement push and model navigation, push navigation using the Main method is Pushcontrollerwithname:context:, Modal navigation using the presentControllerWithNames:contexts: and presentControllerWithName:context: .
As follows:
- (ibaction) modaltopage { // modal navigation [self presentcontrollerwithname:@ " Detailic " Context:nil]; } - (ibaction) pushtopage { //push navigation [self pushcontrollerwithname:@ " detailic"Context:nil" ;}
Summarize:
There are fewer navigational forms in Apple watch, and we need to plan our app's page navigation structure without adding UI elements when the code is running, and try not to allow the principle of running long-running tasks to be more demanding. We need to think about it.
Finally, attach the official document address: https://developer.apple.com/library/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/ Configuringyourxcodeproject.html#//apple_ref/doc/uid/tp40014969-ch2-sw1
Apple Watch notes-in-app navigation mode