问题
Questions:
I was wondering if anyone has tried 3D touch feature on a simulator or rather anyone know whether it actually works there or not.
I know it's a hardware based feature and support is there only for latest iPhone 6S & iPhone 6S Plus models.
On an iPhone 6S simulator, I have tried with Hardware --> Force Touch Pressure --> Deep Press
but no gain.
回答1:
you must develop on a device that supports 3D Touch. Simulator does not support 3D Touch,the documentation from apple, if you need the more information related to this topic, visit this link.
Update
The iOS simulator with Xcode 7.3 beta has an option to Use Trackpad Force for 3D Touch
回答2:
Yes, we can not on Xcode 7.0
BUt there is a way to simulate this by using https://github.com/DeskConnect/SBShortcutMenuSimulator
This saved me once. Hope could save you. Notice that this is using for Quick Actions of 3D force touch features.
回答3:
With Xcode 7.3 beta you can now use 3D touch using a Magic Trackpad 2 or the built-in in newer MacBooks.
回答4:
If you do not have Force Touch trackpad AND iOS device with 3D Touch. By using only the simulator, you can use FLEX.
It works on my Xcode 7.2.1 and iPhone 6S simulator. But the tutorial to use in documentation is not quite right.
For peeking, You need to move a bit of your mouse cursor to let it work while holding Shift + Command.
For Popping, While holding Shift + Command during peeking, press Control 3 times to pop out. I think 3 times means the hardest force applied, as the document stated, each key contributes 1/3 of maximum possible force.
回答5:
There's a bit of code here that allows you to test 3D Touch peek & pop in the simulator. Bear in mind this is code for iOS 9.0, and some of the internal/private methods have changed in 9.1 (Hint: the word 'Position' changed to 'Location' in one of the method names).
https://gist.github.com/nickfrey/07e2c6d8d2e5444fb91d
回答6:
From Xcode 7.3 we can use Macbook's force touch trackpad to deliver touch pressure events to iOS simulator.
Ensure iPhone 6s/ iPhone 6s plus simulator is selected or else "Use trackpad ..." option will appear disabled
回答7:
You can do with shortkeys present on the simulator, under Hardware > Force Touch Pressure
command + shift + 1 for shallow touch
command + shift + 2 for deep touch
来源:https://stackoverflow.com/questions/33007637/testing-3d-touch-with-ios-simulator