I tried to access the trait collection and check "forceTouchCapability", but "forceTouchCapability" simply checks to see if the device is iOS 9.0 or greater.
So, this means that on any device with iOS 9, force touch is 'available'. I need to a way to check if 3D touch is actually supported on the users device (iPhone 6s) and I need to make sure that the 3D Touch option is actually enabled in the accessibility settings.
If your phone supports 3D Touch but it's not working, it could simply be turned off. Go to Settings > General > Accessibility > 3D Touch to check.
Apple 3D Touch is a hardware-based feature Apple introduced in iPhone 6s and 6s Plus devices running iOS 9 that perceives the amount of force a user puts on the touch screen to activate different functions. With Apple 3D Touch, users can take actions without navigating away from the original screen they were on.
I was accidentally casting forceTouchCapability
to a BOOL
(using it as a return value to my method that was set to return a boolean). I needed to check if forceTouchCapability
was equal to UIForceTouchCapabilityAvailable
.
Instead of:
return [[MyView traitCollection] forceTouchCapability];
I need:
return [[MyView traitCollection] forceTouchCapability] == UIForceTouchCapabilityAvailable;
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