I understand that this response clearly states that this is not possible without a private function call. Therefore, according to Apple's terms, this approach cannot be used on an App Store app.
However, some apps already seem to use this function call:
Clearly, this approach is already widely used in App Store apps despite Apple's restrictions.
tl;dr What is the private function call on iOS to get touch size?
Go to Settings > General > [Device] Storage. You might see a list of recommendations for optimizing your device's storage, followed by a list of installed apps and the amount of storage each one uses. Tap an app's name for more information about its storage.
Go to Settings > Display & Brightness > Display Zoom. Select Larger Text to make all the text on iPhone larger. Tap Done, then tap Use Zoomed.
The default text is 100%, but you can make it as small as 80% normal size or as large as 310%.
With iOS8, you can access the touch.majorRadius
property, which is a CGFloat
, grows in multiples of 10.45 and is proportional to the radius of the touched area in Millimeters. touch.majorRadiusTolerance is the second property which can be used with iOS8 and gives the accuracy of the touch radius information. In my measurements it was always half of the majorRadius
step size.
On the iPad Pro the touchscreen is three times more sensitive and picks up the weak signal from the Apple pencil which is below the reporting threshold on older iPad models. The touch radius of the Pencil is reported as 0.25, while even the slightest finger contact will report as 20.84 or more.
Use it like this within your UIView method:
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
// Regular multitouch handling.
[super touchesBegan:touches withEvent:event];
CGPoint center = [touch locationInView:self];
NSLog(@"Touch detected at %6.1f | %6.1f", center.x, center.y);
CGFloat radius = [touch majorRadius];
NSLog(@"Radius = %5.1f; lower limit = %5.1f; upper limit = %5.1f", radius, radius-touch.majorRadiusTolerance, radius+touch.majorRadiusTolerance);
}
Size and pressure are two different animals. Penultimate most likely tests for a large amount of touches in a certain area (palms have a large area after all, generate tons of touches).
Touch "size" does not exist. IOS touch events are generated when a finger contacts the screen. The OS then takes a center point from the touch and that's what you get. It's not a CGRect, it's a CGPoint.
Pressure is 'easier' though. see here for a workaround: Tap pressure strength detection using accelerometer
And while I see you're in the market for private API's, github hosts a number of class dumps: http://github.com/kennytm/iphone-private-frameworks and https://github.com/nst/iOS-Runtime-Headers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With