IOS 9 WatchKit for WatchOS 2

Source: Internet
Author: User

Gold field (GitHub sample source code)

The application can be developed for Appwatch from the AppleWatch release, but the initial version has limited functionality to develop, so only a handful of app vendors have customized the app for Apple, so so far on the Apple Store, There are only a handful of Apple Watch apps that can be seen, most of which are directly related to the sensors in Apple Watch, such as medical, communications, reminders, and running classes.

This time, Apple's watch OS 2 gives app developers more room to grow, and can use Xcode 9 to customize a richer app for AppleWatch. Let's develop a simple AppleWatch app together.

Figure 1 Create watch App

Figure 2 Watch APP Interface Development

Figure 3 App Run

Above just do a simple interface development, specific to see the GitHub sample source code, the following with Cocoon Jin together to see, this watch OS 2 specifically has new highlights features:

Figure 4 WatchKit new support features

From what we can see, this Apple Watch OS2 provides users with digital Crown, Layout and Animation, Taptic Engine, Audio and Video, Alerts, Passkit and other features.

Let's take a look at what these features are like

Speaking of AppleWatch, perhaps the first thought is AppleWatch clock interface, the first generation of Applewatchos did not provide the corresponding interface to support app developers to customize the dial, so everyone is pleasantly surprised, this WatchOS2 provides the corresponding interface.

Figure 5 System default Dial

Figure 6 Apple Watch OS 2 App development Customizable Section

This is the only dial available here as an example, and the rest of the sections are described in Apple's official documentation.

Another highlight is the Audio and Video section, where WatchOS 2 can play music and movie on the AppleWatch.

Figure 7 in Watch app, audio playback control interface

Figure 8 Watch OS 2, video playback control interface

In addition, now watchOS 2 also provides a kind of system prompt window like iOS, examples are as follows:

Figure 9 Popup window in APP

The following code (details), you can pop up like iOS inside the Alertview prompt window, but currently choose a different button, in the callback execution of the event execution is invalid, expect release version of the SDK can fix the problem.

__block Wkinterfacebutton *button = Self.button;

Wkalertaction *englishaction = [wkalertaction actionwithtitle:@ "中文版"

Style:wkalertactionstyledestructive

handler:^{

[Button settitle:@ "Kdan Mobile"];

}];

Wkalertaction *chineseaction = [wkalertaction actionwithtitle:@ "Chinese"

Style:wkalertactionstyledestructive

handler:^{

[Button settitle:@ "Kai tian Software"];

}];

[Self presentalertcontrollerwithtitle:@ "Kdan Mobile"

message:@ "Welcome to read Cocoon Jin iOS9 series Articles!"

Preferredstyle:wkalertcontrollerstylealert

Actions:@[englishaction, Chineseaction]];

All rights reserved, reprint must indicate the author (Jintian) and original source (original)

IOS 9 WatchKit for WatchOS 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.