This article is mainly about how to drag the relevant pages on Apple Watch, with source Emwatchocdemo. You need to do this in the "Emwatchocdemo WatchKit App" in the project, the folder's
WatchKit almost not allow direct coding page, can only drag on the storyboard, and for me this habit directly coding page of people, really very painful.
First, determine the operating process on Apple Watch
First of all, I want a menu page, corresponding to the iphone program, in the case of the Ring letter SDK is not logged in the situation, display the login options, in the case of the Ring Letter SDK login, there are three: sessions, friends, groups.
Then, after clicking on the login option, you can start the iphone for login, because the watch page is too small, no keyboard, the Ring Letter SDK does not support fingerprint or voice login.
Then, after the login operation succeeds, the menu page displays three options, each of which can enter the corresponding page and display the corresponding data.
Finally, go to the chat page, you can display the existing chat record, you can send emoticons. Originally wanted to join the function of sending heartbeat, but found that WatchKit does not support watch app to get hardware sensor parameters, and found a good self-answer article http://www.cocoachina.com/ios/20150323/11396.html
Second, drag and drop on the storyboard
1, click on the folder Interface.storyboard file, the right side will appear the corresponding view display. According to the first step of thinking, directly drag 4 interface Controller, duang~,duang~,duang~, duang~,
The identifier property of each interface controller is strongly recommended to write on, why see Chapter 3rd. To make it easy to differentiate each controller, it is customary for each interface controller to fill in the title attribute. 2, think of the menu, conversation, Friends, group functions, display with table is no better, directly drag table to each controller, and then you will find some strange things,
The Table Row controller is something like a custom UITableViewCell, which is inherited from NSObject by default.
The group should be a new concept, and its role is to block the controls on the page. WatchKit does not support the setting of frame, currently I know, just support in the landscape "left and right", on the vertical "upper and lower", support set size. If you want to implement a nine Gongge style page, compare flattering by using a three row table row Controller, three buttons per line. Not flattering method, sorry, I found that regardless of the arrangement of these properties, can not come out nine Gongge.
3, in the session page display and who chat username, on the Friends page display friend's username, on the Group page display the group's name, with a label can be done.
I drag a label in the group, which is the default.
Choose different options for yourself, see the effect,
4, Chat page is special, need to send their own on the left display, the other side of the hair on the right display. But this is easy to achieve, only need to send and receive in the two table Row controller, and then set the space position can be:
After dragging the top, the page is almost there. In Scheme select Emwatchocdemo watchkit App, compile OK,.
The combination of the ring-letter SDK and Apple Watch (2)