1

I've got a problem with majorRadius property on UITouch.

I'm implementing drawing app and wanted to add some kind of "pressure" drawing.

So for this i use getting size of a touch. But the values of majorRadius property doesn't change smoothly - they changed by some number, but it is not good for me.

Someone can help me how i can get change more smoothly or get proof that is expected behaviour?

2 Answers2

0

According to documentation this is an approximate value:

Use the value in this property to determine the size of the touch that was reported by the hardware. This value is an approximation of the size and can vary by the amount specified in the majorRadiusTolerance property.

If you need pressure detection here you can find help: Tap pressure strength detection using accelerometer

Community
  • 1
  • 1
DanielS
  • 182
  • 14
0

When I tried it, it went up in increments of 2 * majorRadiusTolerance.

This is iOS8. In iOS7 the API was not public yet, but you could get the radius parameter from the OS by accessing

@interface UITouch (Private)
-(float)_pathMajorRadius;
@end

This would indeed change smoothly with pressure area. Be aware that using this interface would get you banned from the AppStore, though.

For your drawing app I recommend to spline the majorRadius values and extract interpolated values from the spline.

Community
  • 1
  • 1
Peter Kämpf
  • 694
  • 11
  • 21