Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
282 views
in Technique[技术] by (71.8m points)

ios - Simulate force touch / 3D touch on iPhone 6S or iPhone 6S Plus simulators

I am trying to simulate a force touch using Xcode 7 GM on the iPhone 6S or iPhone 6S Plus simulator. In particular, I am trying to simulate the force touch on the icon of the test app which is implementing Application Shortcuts.

Let me know if there is a solution to simulate this, I tried the long press which the Watch simulator uses to simulate force touch, didn't work since the iPhone captures it as a long press gesture.

Update: I downloaded the ViewControllerPreview Sample code from Apple. Running their sample application I see that the simulator, although an iPhone 6s, does not support for 3D / force touch feature. I am still unsure if it would support the feature if I were to be using a macbook with a force touch enabled trackpad.

enter image description here

EDIT: Can someone with a macbook that has a force touch trackpad attempt to use the force touch on the trackpad to simulate 3D touch on the iPhone 6s or 6s Plus simulator? My theory is that you can maybe use the force touch trackpad on the new MacBooks to simulate the 3D touch on new iPhone simulators. Add a comment noting the results if you try it and I can update the post.

EDIT2: It seems that Force Touch trackpads on the newer model macbook pros do not help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It says here! at the bottom of the page....

Development Environment

Xcode 7 supports 3D Touch development. All the debugging features of Xcode are available for implementing the new features.

Keep the following in mind:

With Xcode 7.0 you must develop on a device that supports 3D Touch. Simulator in Xcode 7.0 does not support 3D Touch.

With Xcode 7.0 you must implement your peek and pop view controllers in code. Interface Builder in Xcode 7.0 does not provide graphical support for configuring view controllers or transitions for 3D Touch.

Be sure to test your app with 3D Touch both enabled and disabled, ensuring that all features are available to all users. On a 3D Touch device, you can disable 3D Touch in Settings > General > Accessibility > 3D Touch

So unfortunately it looks like we need to get our hands on the actual devices to do it. :-(

EDIT.....

As of Xcode 7.3 there is a way to do this if your MacBook's trackpad supports force touch. See answer by @iPrabu.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...