将按键添加到iPad键盘 [英] Adding key to IPad keyboard

查看:115
本文介绍了将按键添加到iPad键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在iPad应用程序上工作,我的客户想像在普通键盘上那样在键盘上方添加功能键. 问题是他想要iPad系统键盘上的"Fn"键,该键在单击时会显示功能键.

有可能不越狱吗?当他给我发了一些图片的时候..但是我在Google上搜索了很多,但是我找不到任何苹果的文件,上面写着如果应用程序干扰系统键盘或类似的东西,该应用程序将被拒绝.

任何有关如何在键盘上添加Fn键或我可以说服他的东西的指针,我都很感激.

添加解决方案,但前提是您想学习如何做..但对于真正的应用程序,您不应该做的事情

关注此链接查找iPad的KEYBOARD层注意:您需要在iPad上检查UIPeripheralHostView,UIKeyboard适用于iPhone.

在最后的if条件之后,您可以找到UIPeripheralHostView 在其subViews中再添加一个循环,并检查UIKeyboardAutomatic

的条件

完成后..您需要像iOS一样进行递归调用以执行HitTest CGPoint可以是任何东西,具体取决于您要在其中添加密钥,在我的情况下,它就像 CGPoint(50,290)表示右下角的键.

因此在将CGPoint转换为父视图的本地坐标系的同时继续循环子视图(找到UIKeyboardAutomatic后,您可以从 nil 父视图开始.

最终的返回条件是,如果您的视图属于类UIKBKeyView,并且它可以响应您的hitTest点.您已经获得了关键视图及其父视图.现在添加您想要添加的任何内容...

解决方案

Wolfram Alpha应用程序执行了类似的操作.显示键盘后,他们将在其正上方添加自己的视图.他们正在使用-inputAccessoryView.参见 https://developer.apple.com /library/ios/#documentation/uikit/reference/UITextView_Class/Reference/UITextView.html 了解更多信息.

您也可以将键盘完全替换为-inputView.

i am currently working on an iPad application, my client wants to add Function keys as in normal keyboard on Top of keypad which i have done. Problem is he wants a "Fn" key in the iPad system keyboard which ll show the Function keys when clicked.

Is it possible without jail break ? as he sent me some pics where it is done.. but i have googled a lot, but i could n't find any Apple's document which says 'application will be rejected if it interfers with system keyboard or something like that..

Any pointers on How to do add Fn key in keyboard or something which i can show to convince him , s really appreciated..

EDIT : solution to add but only if you want to learn how you can do it.. BUT ITS NOT WHAT YOU SHOULD DO FOR A REAL APP

Follow this link to find the KEYBOARD layer of the iPad NOTE: you need to check for UIPeripheralHostView on iPad , UIKeyboard works for iPhone.

After that final if condition where you find the UIPeripheralHostView add one more loop for its subViews and check condition for UIKeyboardAutomatic

After that is done.. you need do a recursive Call like iOS do for doing a HitTest CGPoint can be anything depending on where you want to add key, in my case its like CGPoint(50,290) for the bottom right key.

so keep looping in subviews while converting your CGPoint into local coordinate system of the parent View(you can start with nil parent view after UIKeyboardAutomatic is found.

Final return condition is if your view is of class UIKBKeyView and it can respond to your hitTest point. you got your key view and its parent.. now add whatever you want to add ...

解决方案

The Wolfram Alpha app did something similar. When the keyboard is shown, they add their own view directly above it. They're using -inputAccessoryView. See https://developer.apple.com/library/ios/#documentation/uikit/reference/UITextView_Class/Reference/UITextView.html for more info.

You can also completely replace the keyboard with -inputView.

这篇关于将按键添加到iPad键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆