[TIMOB-19667] iOS9.1: Support for Apple Pencil
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-02-12T03:27:35.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.2.0 |
Components | iOS |
Labels | applepencil, iOS9.1, notable, qe-5.2.0 |
Reporter | Chee Kiat Ng |
Assignee | Angel Petkov |
Created | 2015-10-05T06:25:47.000+0000 |
Updated | 2018-10-10T16:30:04.000+0000 |
Description
https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UITouch_Class/index.html#//apple_ref/occ/cl/UITouch
iOS 9.1 introduces APIs that help you use coalesced and predictive touches that can be produced by Apple Pencil on supported devices. Specifically, the UITouch class includes:
The preciseLocationInView: and precisePreviousLocationInView: methods, which give you the precise location for a touch (when available)
The altitudeAngle property and the azimuthAngleInView: and azimuthUnitVectorInView: methods, which help you determine the altitude and azimuth of the stylus
The estimatedProperties and updatedProperties properties, which help you prepare to update touches that are estimated
For an example of some ways to take advantage of these APIs in your app, see the sample project [TouchCanvas: Using UITouch efficiently and effectively](https://developer.apple.com/library/prerelease/ios/samplecode/TouchCanvas/Introduction/Intro.html#//apple_ref/doc/uid/TP40016561).
PR pending: https://github.com/appcelerator/titanium_mobile/pull/7419 Demo code :
PR approved!
When using the demo code on the iPad Pro, all touches including the pencil have an undefined force. Tested on: iPad Pro (9.1) Mac OSX El Capitan 10.11.2 Studio: 4.5.0.201602111338 Ti SDK: 5.2.0.v20160210114026 Appc NPM: 4.2.3-2 App CLI: 5.2.0-255 Xcode 7.2 Node v4.2.4 Reopening issue.
PR(Master): https://github.com/appcelerator/titanium_mobile/pull/7712 PR(5_2_X): https://github.com/appcelerator/titanium_mobile/pull/7711
PRs merged!
The PR seems to only implement part of the [attributes](https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UITouch_Class/index.html#//apple_ref/doc/uid/TP40006785-CH3-SW13) The [source](https://github.com/AngelkPetkov/titanium_mobile/blob/3d2c5daa39ef146e808cb48e68d1aabc804f0327/iphone/Classes/TiUtils.m#L1148-L1170) has force, maximumPossibleForce, timestamp and altitudeAngel, but not azimuthAngleInView, azimuthUnitVectorInView, preciseLocationInView and precisePreviousLocationInView I'm asking because [~bimmel] did mention these missing ones in the release notes: https://wiki.appcelerator.org/display/~bimmel/Titanium+SDK+5.2.0+Beta+Release+Note#TitaniumSDK5.2.0BetaReleaseNote-NewiOS9.1Features [~apetkov] given short time, maybe create a ticket for the missing ones?
That line has been updated to the following: "Full coverage for Apple Pencil APIs including force, maximumPossibleForce, timestamp and altitudeAngle." and a note (to myself) added that these features will be documented in 5.2.1 per a conversation with Angel this morning.
Closing ticket as fixed. Verified that the following events/properties can be triggered on the iPad Pro with the pencil: * touchmove * touchstart * touchend * force * maximumPossibleForce * altitudeAngle Tested on: Appcelerator Studio, build: 4.5.0.201602170821 Appc CLI NPM: 4.2.3-2 Appc CLI Core: 5.2.0-269 Arrow: 1.7.27 SDK: 5.2.0.v20160218123934 Node: v4.2.4 OS: El Capitan (10.11.3) Xcode: 7.2 Device: ipad pro (9.2.1) with pencil