Testing 3D touch with iOS Simulator

2019-02-12 12:58发布

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.

7条回答
萌系小妹纸
2楼-- · 2019-02-12 13:38

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.

查看更多
Explosion°爆炸
3楼-- · 2019-02-12 13:43

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

查看更多
混吃等死
4楼-- · 2019-02-12 13:50

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.

查看更多
倾城 Initia
5楼-- · 2019-02-12 13:53

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

查看更多
Bombasti
6楼-- · 2019-02-12 13:58

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楼-- · 2019-02-12 14:02

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

查看更多
登录 后发表回答