简体   繁体   English

以编程方式模拟iPhone上的键盘事件

[英]Programmatically Simulate Keyboard Events on the iPhone

I was wondering if it would be possible to simulate keyboard events - like key down and key up characters - and send them to the iOS device. 我想知道是否可以模拟键盘事件 - 如按键和键盘字符 - 并将它们发送到iOS设备。 Basically, I want to simulate a user pressing a key on the keyboard. 基本上,我想模拟用户按键盘上的键。

have a look at "Automated GUI testing for iOS", for example Automated testing for iPhone and How about UI automation testing for iOS app with instruments & Javascripts 看看“iOS的自动GUI测试”,例如iPhone的 自动化测试以及使用乐器和Javascripts的iOS应用程序的UI自动化测试

You might not want a full blown automated test solution, but that way you can simulate your keyboard events. 您可能不需要完整的自动化测试解决方案,但这样您就可以模拟键盘事件。

There is also a blogpost mentioned: http://alexvollmer.com/posts/2010/07/03/working-with-uiautomation/ 还有一篇博文提到: http//alexvollmer.com/posts/2010/07/03/working-with-uiautomation/

I don't think that's possible. 我不认为这是可能的。 But you could write code in textfield delegate or use NSNotificationCenter to get notification of each keypress. 但是您可以在textfield delegate中编写代码或使用NSNotificationCenter来获取每个按键的通知。 If that's what you are looking for. 如果这就是你要找的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM