1. Interface objects: Examples of wkinterface classes or subclasses;
2. The interface object is not a view;
3. Create interface objects;
"1" label (Labels)
1.WatchKit supports standard fonts and custom fonts;
2.Glance and notification interfaces do not support custom fonts;
3. You must use a custom font to:
(1) Include custom font files in WatchKit app and watchkit extension bundle;
(2) Add uiappfonts keyword in the info.plist file of WatchKit app;
Internationalized Text Code:
The 1.NSLocalizedString family's macro definition allows the program to automatically retrieve localized strings;
2. Format numeric values by Nsnumberformatter classes based on user locale and localization settings;
3. Format time by NSDateFormatter class according to user's locale and local;
Note: Internationalized applications, mainly consider how to layout the interface, so that labels or other text controls can be extended.
"2" Picture images
1.WKInterfaceImage class;
2.wkinterfacegroup,wkinterfacebutton,wkinterfacecontroller class;
3. Use images in PNG format whenever possible;
4.setwidth,setheight, so that the picture is displayed in the appropriate size.
5. Use image assets to manage pictures.
Picture caching:
1.addcachedimage:name or Addcachedimagewithdata:name methods to cache pictures;
2. Cache animation Picture: animatedimagewithimages:duration;
3. Use cached pictures:
(1) For the Wkinterfaceimage object, call the Setimagenamed method;
(2) for the Wkinterfacegroup,wkinterfacebutton object, call the Setbackgroudimagenamed method;
(3) Removecachedimagewithname: Or Removeallcachedimages method to clear the cache;
"3" Table (tables)
1. Use a table to display a list of dynamically changing data;
2.WatchKit through the Wkinterfacetable class to support a single list;
3. If the data is displayed in the table, the data should be completed by the data layout in advance by encoding;
4. Support Multiple lines of content display type;
5. can be rolled; '
6. May set the background or the picture;
7. Support user interaction;
Contents of the Configuration table:
1. Determine the number and type of rows according to the data to be displayed;
2, create lines with Setrowtype: or Setnumberofrow:withrowtype.
3.rowControllerAtIndex: Method traversal line;
4. Use row Controller object configuration row content;
"4" button (Buttons)
1. Create a button with the same width as the screen, and limit it to 2 buttons horizontally;
2. Multiple buttons are of the same height;
3. Use the default rounded corners. The standard button rounded angle is 6points.
"5" contextual menu (context Menus)
1. Contextual menus are optional, WatchKit displays menus on top of content;
2. Display up to 4 actions (action), each action consists of a title and a picture;
3. Each action is added to the menu in order from top to bottom, left to right;
4. Menu is not layered also can not scroll;
5. Can be designed or programmed to configure the menu;
Attention:
1. The current screen has only one menu;
2. Do not create an action can only affect the selected item or part of the interface;
3. Each action must have a picture and a label string. The picture is the background, the label string is limited to two lines;
Menu Picture:
1. The icon in the menu is a template picture, transparency determines the style of the picture, ignoring the color of the picture;
2. Menu picture to use PNG format. Do not use a jagged PNG format picture (interlaced PNG);
GitHub home: https://github.com/chenyufeng1991. You are welcome to visit.