[IOS/translation] Cocoa Touch Layer

Source: Internet
Author: User
Tags call back processing text

[IOS/translation] Cocoa Touch Layer

The Cocoa Touch layer contains key libraries to build IOS applications. These libraries define the performance of applications. They provide basic space for applications and key technologies such as multitasking, touch-based input, message push, and many advanced system services. When designing your applications, you need to study them first.

Advanced features

The following sections describe some key technologies

App Extensions ( App Extension Programming Guide) Handoff transfer ( Guide) Document Picker Document selector ( Guide) AirDrop TextKit ( Guide) UIKit Dynamics Multitasking ( Guide) Auto Layout ( Guide) Storyboards UI State Preservation Apple message pushing Service Apple Push Notification Service Local and Remote Notification Programming Guide Gesture Recognition Gesture Recognizers Event Handling Guide for iOS Standard System View Controllers ( View Controller Programming Guide for iOS) App Extensions ( App Extension Programming Guide)
IOS8 allows you to use Application Extensions in the system extension area to implement custom functions in a user task. For example, you can provide an application extension to help users send content to the public sharing network. After you install and use the extension, you can click the share button in the current application to share. Your custom share extensions receive, verify, and send user content. The system's extension list is available in the shared menu and depends on the user's choice.
In Xcode, you create an application extension to add pre-configured applications to the application. After a user installs an application that contains extensions, this extension is available in the "Setting application. When other references are run, the system can be visually expanded in the system UI, such as sharing menus.
IOS supports app extension sharing and sharing content to public networks or other places. Run. Execute a small task tool that provides a quick upgrade or allows a brief task to be edited in the message center on the current page, in the Photo application, execute a document provider for modifying images or videos and save a document locally so that other applications can access it. The application uses the Picker interface to manage or move files. Custom keyboard: All applications on the device. You can use a custom keyboard.

Each extension point defines the appropriate APIs. When you use an application extension template for development, you can obtain the default target, content method stubs, And the extension attribute list settings you choose.

Handoff transfer (Guide)
Handoff is a feature of the OS X system and IOS system. It spans the continuity of devices and extends the user experience. Handoff allows you to perform an activity on a device, jump to another device, and skin the same activity on another device. For example, a user browses a long article on Safari, extracts the article to an IOS device using the same AppleID, or opens a same webpage on IOS Safri, and on the same scroll point as the original device. Handoff makes users feel a seamless user experience.
Handoff can be used only by using a small API. Each activity in the application resumes the corresponding content activity on other devices. When you select a reply activity, this object is sent to the device to be restored. Each user's activity object has a callback that restores the activity state at the appropriate time, for example, before the user activity object, it is sent to the device.
If you need a lot of data to continue an activity, the user's activity objects are easy to transmit. The application in recovery has an option to open a stream to the source application. Document-based applications can automatically support activities under an iCloud-based document.

Document Picker Document selector (Guide)
The Document Picker (UIDocumentPickerViewController) interface allows the user to access files other than the application sandbox. It is a simple principle of sharing between applications. A composite workflow is allowed because you can modify a document in different applications.
Document Picker allows you to access files from many Document providers. For example, the iCloud document provider agrees to access the iCloud document storage in other applications. Third-party developers can provide additional document providers from extended storage providers.

AirDrop
AirDrop allows users to share images, documents, links, and other data on nearby devices. You can share files with other applications in the UIActivityViewController class. These classes show different options to share the content to your specified place. If you use this class, you need to consider adding your interface.
To use AirDrop to receive files, you need

Add the appropriate document type keyword in Info. plist of Xocde. The system uses this information to determine whether your application can use it to implement the application: openURL: sourceApplication: annotation:

The received file is saved in the Documents/Inbox dictionary. If you want to modify the file, you must remove it from the dictionary and then modify it. (In Inbox, only files can be read and deleted ). Files are encrypted in this path. Therefore, files cannot be obtained when the device is locked.

TextKit (Guide)
TextKit is a fully functional, advanced class for some columns, processing text and exquisite typography. With TextKit, you can use different la s in paragraphs, columns, and pages. You can display text in any area as an image. You can also use it to manage different fonts. If you want to use Core Text to read Text, you should use TextKit. TextKit is a complete text-based library. It makes it easier to create, modify, display, and store text, and use less code in IOS.
TextKit contains the new UIKIt class, along with the existing class

The NSAttributedString class supports new features. NSLayoutManager class, nstextiner iner class for generating glyphs and text formatting, defining Text Formatting for a region NSTextStorage defines a basic interface for managing text content

UIKit Dynamics
The application can now develop dynamic behavior on the UIView object, and also follow the UIDynamicItem protocol for other objects. (The object follows this protocol calledDynamic item). Dynamic Behavior provides a way to make the user experience of an application the same as the dynamic behavior and features of the real world. UIKit dynamically supports the following features:

The UIAttachmentBehavior class defines a connection between two dynamic objects, one dynamic object, and one vertex. When one moves, the other moves, and the other moves. The connection is not completely static. An impact behavior also has the beating and shaking attributes to determine how the behavior changes. The UICollisionBehavior class allows the dynamic items to be added to the collision, and collision with the edge of each item and the item. This behavior also enables them to make appropriate responses after the collision. UIGravityBehavior class, which adds a Gravity Vector to a dynamic item. The Gravity Vector accelerates the dynamic items in the vector direction until the collision reaches the appropriate boundary. UIPushBehavior class, which defines a connected or instantly pressed dynamic items UISnapBehavior class and defines an elastic point for a dynamic item. This Item pops up at a point and shows the configured effect. For example, a dynamic item can play on a point, like an attack on a spring.

When you add it to an animation object, the dynamic behavior becomes active. This dynamic object is defined as a UIDynamicAnimator class. The content of the dynamic execution behavior provided by this animation. A dynamic ITem can have multiple actions, but all actions must be motion in the same animation object.

Multitasking (Guide)
Battery files are an important IOS device. The objective of the multi-task model in iOS is to maximize the battery life and give their applications the important work they need to do. When you press the Home key, the foreground applications are ranked to the background. If the application does not have much to do, it will be suspended, and put in a frozen area, the memory will not execute his code. The application must provide a specific type of work to tell the system request background time.

Applications and requests with limited time to complete some important tasks applications can support specific services to request implementation for these services. For example, playback applications can use local notifications of specific time to generate user notifications, even if the application is not running, the application can download a specific content from the network. The application can download the content and then push a message.

Auto Layout (Guide)
Automatic Adaptation helps you use less code to build a dynamic interface. With automatic adaptation, you can define rules on your user interface for how to adapt elements. These rules express a lot of class relationships and are more intuitive to use than the previous springs and struts model. For example, you can define that a key is always 20 pixels away from the Left Border of the parent interface.

They support localization through separate string exchanges, rather than requiring you to update your layout. They support images of user interface elements for the right-to-left language, such as Hebrew and Arabic. They provide better separation of responsibility between objects on the interface or controller layer.
An interface Object usually has a standard size. It is located in the parent interface and has a positional relationship with its own interface of the same level. The control of one interface can overwrite those that do not follow the standard.

Storyboards
Storyboards: a recommended method for designing user interfaces. Storyboards allows you to design your user interface in one place, so you can see all your interfaces, view controller, and understand how they work together. An important part is that Storyboards has the ability to define segues connections, which can help transfer between view controllers. These transfers allow you to capture the interface streams you have set, except the content. You can define this transfer on the surface. In Xcode, or the program initializes them.
You can use a simple storyboard file to store interfaces and viewcontroller in all your applications, or use multiple storyboards for management. At the time of creation, Xcode divides the content of the storyboard file into discrete parts, which can better facilitate initialization and loading. Your applications do not need to operate on them directly. The UIKit Library provides convenient classes to access the content of the storyboard.

UI State Preservation
Status retention provides a seamless user experience to keep your application running, even if it does not. If the system memory is under pressure, it can quickly close one or more background and applications. When an application moves from the foreground to the background, it can protect the status of the interface and view controller. By the next cycle, he can protect the information status to the restart interface and viewcontroller, provide configuration and let him display the same content as before, rather than re-open.

Apple message pushing Service Apple Push Notification Service Local and Remote Notification Programming Guide
The message PUSH Service of Apple provides a method to notify users of new information about the IOS application, even if the application is not running. With this service, you can push text messages and add an app icon or sound effects to your device at any time. These messages let users know that they need to open your application to accept relevant information. On IOS7, you can push static messages to let your application know and download new content.
From the design standpoint, this is two parts that enable push to serve IOS applications. First, the application must send a notification request, and process the notification immediately after the transfer. Second, you need to provide the server to process the generated notifications immediately. This process must work with your local server and the Apple PUSH Service to generate notifications.

Local communications (Local and Remote Notification Programming Guide)
Local notifications supplement the existing push notification mechanism and provide an application with a method to generate local notifications without using the server. When the application runs in the background, you can use local notifications to tell the user that something important has happened. For example, if the navigation application runs in the background, you can use local notifications to warn users when to turn. The application can also set a local notification in the future, even if the application is not running, the notification can be delivered.
One advantage of local notifications is that they are independent of applications. After a notification is set, the system will manage and transmit them, and your application does not need to run.

Gesture Recognizers Event Handling Guide for iOS
Gesture Recognition common gesture detection, such as swipes slide and pinches pinch in your application. Because they use the same gesture recognition as the system, gesture recognition provides consistent behavior for applications. Use one, add a gesture recognition in the application, and give him an operation method to execute a gesture event. Gesture Recognition is a difficult final task from the original touch and determines when they are a gesture.
All Gesture Recognition is based on the UIGestureRecognizer class and determines the basic behavior. UIKit supports standard gesture recognition, such as taps, pinches, pans, swipes, and rotations. You can define some gesture recognition in your application. For example, you can tell the Pat behavior to define multiple Pat operations to execute your method.

Standard System View Controllers (View Controller Programming Guide for iOS)
Many system libraries define the standard system interface of view controller. As long as possible, the provided view controller is better than your own definition. We encourage you to use these view controllers to implement your user interfaces in your applications. As long as you need to execute a subsequent task, you can use view controller from the corresponding library.

Displays and modifies relevant information. Use view controller of Address Book UI library to create and modify calendar events, use view controller of EventKit UI library to write emails or SMS, and use view controller of Message UI library to open or preview file content, use the UIDocumentInteractionController class of the UIKit library to take a photo or hold a photo in the album. Use the UIImagePickerController class of the UIKit library to take a video clip and use the UIImagePickerController class of the UIKit library. Cocoa Touch Layer

Next we will introduce the functions of this Library and the Library.

List 2.0 Address Book Interface AddressBookUI. framework(AB) 4.0 calendar event UI_ EventKitUI. framework
_ (EK) 3.0 games_ GameKit. framework
_( Guide) (GK) 4.0 Advertisement IAd. framework( Guide) (AD) 3.0 Map MapKit. framework( Guide) (MK) 3.0 information UI MessageUI. framework( About System Messaging) (MF) 8.0 notification Icationicationcenter. framework( Guide) (NK) 8.0 push PushKit. framework(PK) 5.0 Twitter Twitter. framework(TW) 2.0 interface UIKit. framework(UI)

2.0 Address Book Interface AddressBookUI. framework
Provides a standard system display interface for the address book, and allows you to create new address book information and modify existing information. This library standardizes the address book interface and simplifies display. So that all programs use a unified interface. (AB)

4.0 calendar event UI_ EventKitUI. framework
_
Provides Standard System Calendar interfaces for ViewController to display and modify calendar events. In the EventKit library, this library is built on associated data. (EK)

3.0 games_ GameKit. framework
_(Guide)
Game Center is supported. Users can use it to share Game-related data. (GK)

Allows users to create network accounts, log on to Game Center, and communicate with anonymous users. Users can set tags for their friends. Rankings: allows you to upload Game scores to the Game Center and retrieve scores. You can use this feature to let users tell their friends their best scores. Achievements: allows applications to record users' achievements in the game. Challenges: You can challenge your friends in your applications to get a score or achievement. Turn-based games to create a persistent competition. The competition status will be stored in the iCloud

4.0 Advertisement IAd. framework(Guide)
This allows you to place banners in your applications. The advertisement integrates the standard interface and the interface you want to push. This interface provides the apple iAD service, which automatically obtains the relevant loading and pushing different media, and handles ad click events. (AD)

3.0 Map MapKit. framework(Guide)
You can place a map with the scroll page function on your application interface. Before you display a map, you can use this library to automatically display the map content and display it. You can mark a point of interest and annotate it. You can also embellish a area on a map with a custom coverage area. For example, you may use a region to draw bus stops and annotate stores and restaurants to highlight attachments.
In addition, when displaying a map, this library combines the map application and the Apple map service to provide better navigation. From a map application, you can call back map navigation from the application. Applications can provide professional navigation types, such as Subway information. You can request the navigation. Applications can also request walking requests from the Apple Server and self-driving navigation, and then integrate navigation information to provide point-to-point navigation routes to users. (MK)

3.0 information UI MessageUI. framework(About System Messaging)
Provide Email and SMS display for your application. This information is pushed to the interface through a ViewController. You can enter the recipient, subject, main content, and attachment in the filling area. After the display page, you can modify the information before sending the message. (MF)

8.0 notification Icationicationcenter. framework(Guide)
Create a widget to display notifications in the information center. (NK)

8.0 push PushKit. framework
Provides registration support for VoIP applications. This library replaces the IPAs previously registered VoIP applications. Instead, it maintains a continuous connection, so it consumes power. When a call signal comes in, the application can receive notifications through this application. (PK)

5.0 Twitter Twitter. framework
It has been replaced by the Social database. Supports the UI of tweets and the creation of Urls to access the Twitter service. (TW)

2.0 interface UIKit. framework
In IOS, create a key infrastructure for implementing graphics and an event-driven Application (UI)

Basic Application Management and basic controls, including the application's main thread user interface management, including support for storyboards and visualized Management (nib) file a Viewcontroller model to compress content objects installed on your user interface. The standard system interface and control show support for management touch-and motion-events. Support for Document mode including iCloud integration (Document- based App Programming Guide for iOS) graphical and interface support, including support for additional display (View Programming Guide for iOS) support for multi-task (Multitasking) Support for Drawing (Drawing and Printing Guide for iOS) supports custom standard UIKitking controls to cut text and network content, copy and paste to support the animation effect of user interface content in the system, through the URL schemes and library interface, integrate other applications to Disable User accessibility. Support Local messaging of Apple Push Notification Service) PDF creation supports the use of a system-like custom interface keyboard. Supports the creation of text views to interact with the system keyboard. supports sharing content through email, twitter, facebook, or other servers.
In addition to supporting the basic code for building applications, UIKit also supports some special features of devices. Built-in camera user's Image Library device name and model information power status information distance sensor information remote control information connected through the headset

Related Article

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.