Programmatically Simulate Keyboard Events on the iPhone

て烟熏妆下的殇ゞ 提交于 2019-12-10 17:25:16

问题


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. Basically, I want to simulate a user pressing a key on the keyboard.


回答1:


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

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/




回答2:


I don't think that's possible. But you could write code in textfield delegate or use NSNotificationCenter to get notification of each keypress. If that's what you are looking for.



来源:https://stackoverflow.com/questions/11339004/programmatically-simulate-keyboard-events-on-the-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!