如何在屏幕上显示所有触摸以演示 iPhone 应用程序?
现在我们在 iPad 2 上有了显示镜像(现在是有线的……iOS 5 中也有无线),有没有一种简单的方法可以在屏幕上显示所有触摸?这在演示应用程序时有用吗?
我正在寻找的是能够仅包含一些 SDK,并且可能更改一行代码,之后我的所有触摸都将显示在屏幕上。
我见过许多其他演示应用程序的方法: 1)使用模拟器和屏幕捕获工具,将鼠标光标变成一个大的白色圆圈 2)越狱黑客可以记录屏幕/显示所有触摸
但是,我的目标是仅在实际设备上运行的常规应用程序上显示触摸。
Now that we have display mirroring on the iPad 2 (wired now... wireless coming in iOS 5), is there an easy way to display all touches on screen? This would be useful when demoing an app?
What I am looking for is the ability to just include some SDK, and maybe change a line of code after which all of my touches will be displayed on screen.
I have seen many other ways to demo apps:
1)Using the simulator along with a screen capture tool that will turn your mouse cursor into a big white circle
2)Jailbreak hacks that can record the screen/display all touches
However, my goal is to just have touches displayed on a regular app running on an actual device.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我意识到这个问题现在已经很老了,但是现有的解决方案对我来说都不够好。我需要一些可以在多个窗口中开箱即用的东西,而不必对窗口进行子类化或进行任何摆弄。
所以我创建了 ShowTime,它(直到 Swift 4)实际上只需要您将 pod 添加到您的 podfile 或将 ShowTime.swift 添加到您的目标。其余的都是完全自动的,除非您想配置默认值。
https://github.com/KaneCheshire/ShowTime
从 Swift 4 开始,还有一个额外的步骤,在您的 AppDelegate 中,只需设置ShowTime.enabled = .always
或ShowTime.enabled = .debugOnly
编辑:Swift 4 现在再次自动启用所以不需要手动启用。
I realise this question is old now, but none of the existing solutions were good enough for me. I needed something that worked out of the box with multiple windows, without having to subclass windows or do any fiddling about.
So I created ShowTime, which (up until Swift 4) literally just requires you to either add the pod to your podfile or add ShowTime.swift to your target. The rest is totally automatic unless you want to configure the defaults.
https://github.com/KaneCheshire/ShowTime
Starting from Swift 4 there's one extra step, in your AppDelegate, just setShowTime.enabled = .always
orShowTime.enabled = .debugOnly
Edit: Swift 4 now has auto-enabling again so no need to manually enable.
您可以使用 Touchposé:https://github.com/toddreed/Touchpose
You can use Touchposé: https://github.com/toddreed/Touchpose
在查看了所有不同的库之后,我意识到,至少就我而言,它们是巨大的杀伤力。我只是想制作一个应用程序预览视频,并且我只需要在应用程序中的两个位置使用它。
因此,我花了一点时间想出了以下代码,您可以将其与基于 SpriteKit 的场景一起使用,以逐个场景地启用触摸显示。 (并且,如果您从头开始,您可以子类化 SKScene 并将其直接烘焙以供所有场景使用。)
当然,您必须自己制作 touchMarker.png 文件。我在 Photoshop 中创建了我的,它只是一个简单的 100x100 白色圆圈,透明度为 50%。老实说,获得正确的图像所花费的时间比让代码正常运行所花费的时间要长。 (如果有办法在这里附加图像,我会这样做。但是,嗯,这是我的第一天。是的。)
需要注意的是,您已经找到并保存了最初触摸的节点(保存在“节点”变量中) )在执行此操作之前。如果不这样做,原始值就会丢失,并且在显示触摸标记后,所有节点测试都将不起作用。
希望这对其他人有帮助!
迪兹
After looking at all of the various libraries for this, I realized that, at least in my case, they were massive overkill. I just wanted to make an App Preview video, and I just needed it for two places in my app.
So, I spent a little time and came up with the following code that you can use with a SpriteKit-based scene to enable touch display on a scene-by-scene basis. (And, if you are starting from scratch, you could subclass SKScene and bake this right in for use by all your scenes.)
Of course, you'll have to make the touchMarker.png file yourself. I created mine in Photoshop and it's just a simple 100x100 white circle with a 50% transparency. Honestly, it took longer to get that image just right than it did to get the code working. (If there's a way to attach images here, I'll do that. But, um, it's my first day. Yeah.)
One caveat, you have find and save off the originally touched node (saved here in the "node" variable) before you do this. If you don't, that original value gets lost and none of your node testing will work after you display the touch marker.
Hope this helps someone else!
Diz
您必须在容器视图上编写自定义触摸,并将圆形视图的中心移动到触摸的 locationInView。
You'd have to code in custom touches on the container view and move the center of a circular view to the touch's locationInView.
我可能会尝试使用touchesBegan、touchesMoved 和touchesEnded 来捕获KeyWindow 上的所有触摸。然后,您可以在应用程序上显示一个透明视图,然后在适当的位置显示触摸。
I would probably try to capture all touches on the KeyWindow with touchesBegan, touchesMoved and touchesEnded. You could then have a transparent view lying over the application which would then show the touches at the appropriate location.
我最近拼凑出的一个替代解决方案使您能够定位任何应用程序(包括 SpringBoard 和其他 iOS 系统应用程序,即“设置”),并且需要您自己的应用程序进行零修改或库,唯一的缺点是它需要越狱。我想无论如何我都会分享,以防其他人发现它有用。
https://github.com/lechium/touchy
我基于它 https://github.com/mapbox/Fingertips 但注入 UIWindow 而不是替换它以添加显示触摸所需的所有内容。
如果您已越狱,但不想自行构建和安装 touchy,请在我的 Cydia 存储库上查看: https://nitosoft .com/beta2
An alternative solution I cobbled together recently enables you to target any app (including SpringBoard and other iOS system applications ie Settings) and requires zero modifications or libraries for your own application, the only drawback is it requires a jailbreak. I figured i'd share regardless just in case anyone else finds it useful.
https://github.com/lechium/touchy
I based it around https://github.com/mapbox/Fingertips but inject into UIWindow instead of replacing it to add everything necessary to make showing the touches possible.
If you are jailbroken but don't feel like building and installing touchy on your own its on my Cydia repo: https://nitosoft.com/beta2