我想知道是否有可能在iOS模拟器中模拟苹果铅笔。
据苹果公司的一位Xcode iOS Simulator: can I use the mouse as pretend Apple Pencil input (on iPad Pro), for testing?表示,这是不可能的。答案是2017年6月给出的。
根据https://developer.xamarin.com/guides/cross-platform/windows/ios-simulator/ (最后一段: Windows中的手写笔支持也被翻译成模拟器上的苹果铅笔输入),使用Xamarin的远程iOS模拟器可以模拟铅笔。(他们已经有了这个功能好几个月了)
所以,我有点困惑。据我所知,Xamarin也使用了普通的iOS模拟器。(他们只是通过Windows PC上的远程连接来显示它)如果他们在模拟器中有铅笔支持,任何人都有可能,不是吗?
发布于 2021-05-18 07:17:03
对于那些在2021年坚持这样做的人,可以尝试以下几点:
iOS 14
#if targetEnvironment(simulator)
canvasView.drawingPolicy = .anyInput
#else
canvasView.drawingPolicy = .pencilOnly
#endif
另外,在Settings应用程序中还有一个名为“只有用苹果铅笔绘制”的全局设置。这可以从UIPencilInteraction.prefersPencilOnlyDrawing
中的PencilKit中读取。
iOS 13 (仅限)
#if targetEnvironment(simulator)
canvasView.allowsFingerDrawing = true
#else
canvasView.allowsFingerDrawing = false
#endif
https://stackoverflow.com/questions/45451739
复制