问题
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 ...
回答1:
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
.
来源:https://stackoverflow.com/questions/10046523/adding-key-to-ipad-keyboard