ios – 用UIKeyCommand检测连续按键

ios – 用UIKeyCommand检测连续按键,第1张

概述是否可以连续按下按键? 我正在使用keyCommands:截取在外部键盘上按下的箭头键,但是每次只能收到1个呼叫.只要按住键,我会希望每X毫秒多次拨打一次电话,或者在按下该键并释放该键时拨打电话. 这是我的代码: - (NSArray *)keyCommands{ UIKeyCommand *upArrow = [UIKeyCommand keyCommandWithInput:UIKe 是否可以连续按下按键?

我正在使用keyCommands:截取在外部键盘上按下的箭头键,但是每次只能收到1个呼叫.只要按住键,我会希望每X毫秒多次拨打一次电话,或者在按下该键并释放该键时拨打电话.

这是我的代码:

- (NSArray *)keyCommands{    UIKeyCommand *upArrow = [UIKeyCommand keyCommanDWithinput:UIKeyinputUpArrow                                                modifIErFlags:0                                                       action:@selector(upArrow:)];    UIKeyCommand *downArrow = [UIKeyCommand keyCommanDWithinput:UIKeyinputDownArrow                                                  modifIErFlags:0                                                         action:@selector(downArrow:)];    UIKeyCommand *leftArrow = [UIKeyCommand keyCommanDWithinput:UIKeyinputleftArrow                                                  modifIErFlags:0                                                         action:@selector(leftArrow:)];    UIKeyCommand *rightArrow = [UIKeyCommand keyCommanDWithinput:UIKeyinputRightArrow                                                   modifIErFlags:0                                                          action:@selector(rightArrow:)];    UIKeyCommand *leftArrowCmd = [UIKeyCommand keyCommanDWithinput:UIKeyinputleftArrow                                                     modifIErFlags:UIKeyModifIErCommand                                                            action:@selector(leftArrowCmd:)];    UIKeyCommand *rightArrowCmd = [UIKeyCommand keyCommanDWithinput:UIKeyinputRightArrow                                                      modifIErFlags:UIKeyModifIErCommand                                                             action:@selector(rightArrowCmd:)];    UIKeyCommand *lCmd = [UIKeyCommand keyCommanDWithinput:@"l"                                             modifIErFlags:UIKeyModifIErCommand                                                    action:@selector(lCmd:)];    UIKeyCommand *rCmd = [UIKeyCommand keyCommanDWithinput:@"r"                                             modifIErFlags:UIKeyModifIErCommand                                                    action:@selector(rCmd:)];    UIKeyCommand *mCmd = [UIKeyCommand keyCommanDWithinput:@"m"                                             modifIErFlags:UIKeyModifIErCommand                                                    action:@selector(mCmd:)];    return @[upArrow,downArrow,leftArrow,rightArrow,leftArrowCmd,rightArrowCmd,lCmd,rCmd,mCmd];}
解决方法 似乎这在iOS 7中确实是不可能的. 总结

以上是内存溢出为你收集整理的ios – 用UIKeyCommand检测连续按键全部内容,希望文章能够帮你解决ios – 用UIKeyCommand检测连续按键所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1113446.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存