Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to work with 3D Touch in iOS 9? Does it trigger event when pressure changes?

Tags:

ios

uikit

uitouch

I wonder if I can detect continuously changing pressure of user input on iPhone 6s.

With simple touch it's obvious, from the UIResponder you can hook into touchesBegan and TouchesMoved and you'll have the coordinates every time when the user touches the screen and when moves his/her finger, you can have the current position on every update.

However, I'm not sure how the new :force property works. If you read the "force" in touchesBegan, wouldn't you get some minimal pressure value that was detected at the initiation of the touch?

Is there a way to get update on the force value as it changes, just like the touchesMoved? Maybe there is a method like "forceChanged"?

like image 647
mrtksn Avatar asked Sep 22 '15 00:09

mrtksn


People also ask

Is iPhone pressure sensitive?

3D Touch makes your iPhone pressure-sensitive, so it knows how hard you are pressing on the screen. In fact, 3D Touch has three distinct levels of sensitivity, and can perform three different actions depending upon how hard you press. A normal, light press has the same effect it always has.

What is the difference between 3D Touch and Haptic Touch?

Apple's Haptic Touch technology is similar to 3D Touch but it doesn't rely on pressure. Instead, Haptic Touch kicks in when a user long-presses the screen, offering a small vibration as acknowledgement following the press; haptic feedback, hence the Haptic Touch name.

How does iPhone 3D Touch work?

On iPhones with 3D Touch, the capacitive sensors are directly integrated into the display. When a press is detected, these capacitive sensors measure microscopic changes in the distance between the back light and the cover glass. On the Apple Watch, a series of electrodes line the curvature of the screen.


1 Answers

From the iOS 9.1 Release Notes

On 3D Touch capable devices, touch pressure changes cause touchesMoved: to be called.

Apps should be prepared to receive touch move events with no change in the x/y coordinates.

This means that a touchesMoved: callback either indicates a continuous change in force or location or both!

Hopefully this information will one day make it into the UITouch documentation.

like image 144
Rhythmic Fistman Avatar answered Sep 23 '22 06:09

Rhythmic Fistman