Notes on 3D Touch development Tips

Source: Internet
Author: User
Tags home screen

Iphone6s and Iphone6s Plus is equipped with iOS9, a new feature called 3D Touch, this feature is very useful, the key is to use, which gives a new way to interact with the choice and thinking, such as the game's additional control options, drawing applications in the fine-grained ( fine-grained) control, or even an excellent choice to replace the long-press operation (Tap-and-hold) we have used on IOS devices.

Developers can use 3D Touch through a very simple API, essentially a simple new property of Uitouch.

Override func Touchesbegan (Touches:set<Uitouch>, withevent event:uievent?) {     guard Let Touch = Touches.first else {return}     if traitcollection.forcetouchcapability = =. Available {        println ("Touch pressure is \ (Touch.force), maximum possible-is \ (Touch.maximumpossibleforce)")     }}

In addition to the new APIs in Uitouch, Apple has provided two sets of classes to add 3D Touch functionality to the app: Uipreviewaction and Uiapplicationshortcutitem.

uipreviewaction allows developers to quickly display something in a new preview window when the user touches a UI element using the 3D Touch feature. This fast-browsing approach to application-specific content is really great, for example, when we can quickly preview email messages, photos, and even web content without having to pop up a full view controller.

The Uiapplicationshortcutitem object enables an amazing new feature to be activated on the IOS home screen. When a user presses an app's icon with 3D Touch, a list of options pops up, allowing the user to quickly jump to a specific part of the app or perform a function within an app.

In summary, the introduction of 3D Touch provides an entirely new way for iOS devices to interact, and will bring new generations of innovation to the next iOS app. Example code and related information about 3D Touch can be found on the Apple developer site https://developer.apple.com/ios/3d-touch/Reference.

Notes on 3D Touch development Tips

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.