iOS custom keyboard on iPad - ios

I'm building an iPad app witch will use a numeric keyboard. The numeric keyboard for the iPad is really huge, all i need is something smaller, something like the decimal keyboard for the iphone.
If i use the default one, half the screen gets covered with keys i dont need. I know i can move the textfields out of the way but it is such a waste of screen space.
So i tried building a custom UIView with no button for start and setting the textfield.inputview to my custom UIView.
The only thing i got is that my custom view is displayed like/in place of/the stock keyboard and the only thing i can change is the height of the custom view.
How could i build a sort of custom keyboard that apple will accept and works with the textfields.
Thank you.

I found what i was looking for. The answer is UIPopover. I managed to build a custom keypad inside a uipopover.
Here's a good tutorial for the uipopover:
http://www.appcoda.com/uiactionsheet-uipopovercontroller-tutorial/
And here's some more info on what you have to do to make it work:
http://iphone-bitcode.blogspot.fr/2011/12/custom-number-pad-on-ipad.html

Related

Custom Keyboard Accessory view input

I have created a custom accessory view to supplement the standard Apple alpha iOS keyboard.
The purpose is to add a line of numeric keys to prevent flipping back and forth between keyboard views. At first, I created a toolbar and loaded it with a set of 0 - 9 titled buttonItems and it functioned quite well. However, it looked terrible, not at all like the alpha keys despite adding a rounded rect background image to each key because the system apparently prevents customizing font size and button spacing inside the stack view of the toolbar. Therefore, I created a UIView xib and loaded it with a stackView full of customized numerical buttons. When I add the UIView as the accessory view it looks pretty darn close to the rest of the Apple Alpha keyboard. The issue now is that the touch-up events go to the UIView class of the accessory view. Is there a clever, efficient way to have the button presses in the accessory emulate the std keyboard feeding into TextField: shouldChangeCharactersIn? I could package the button presses into a local notification event to get it into the class holding the textField but that seems terribly inelegant! Any suggestions would be greatly appreciated. Stay Safe!
Not the best answer, but I did implement notification on key button press with an observer in the main view class. The observer does a TextField.insertText which is suboptimal since I will need to refactor the several hundred lines of code that performs real-time language translation in the shouldChangeCharacters methods. Ah well.

UITextField not responding to touch in iOS8?

So I have multiple UITextFields in my storyboard, but there is one isolated field that will not respond to any touch (neither in the simulator nor on the device) for all iOS versions, besides on the very right side of the field? This may have something to do with the constraints/frame of the field, but I have tried resolving autolayout issues, but nothing seems to work.
This is what my storyboard looks like (with the malfunctioning UITextField selected):
And this is what the simulator looks like:
Any ideas? There is very little functionality code-wise, so I imagine this is an Xcode formatting thing.
Form the picture it looks like the picker is actual over the textfield. It doesn't look like it but those are rather tall. You could try panning on the text field and see if the picker moves. Also you can try hiding it and see if that changes anything.
Good luck and hope that helps.

Editing keyboard layout in iOS

Is there a possibility to change the button layout on a pre-made ios keyboard?
I would like to add "done" and "punctuation" buttons to numeric keyboard.
There is the Decimal Pad available but in this case i would have to add a custom done button at the top.
Is there a way to move the "delete" button to the right and make it half of its current width, put next to it the "decimal" button and on the former place of "delete" locate "done"?
No, you'll have to implement your own keyboard, if you duplicate the Apple one it will get rejected.
iOS does not support making those types of changes to the keyboard, the only thing you can do is change the text associated with the Done/Enter button by changing the UIReturnKeyType of the associated UITextField.
You can make a View With the buttons you want and set the inputView to the custom view you made ,, and you got a custom keyboard :D
You cannot directly modify the keyboard other than by choosing one of apple's presets. However, it is possible to add additional keys above it using -inputAccessoryView, like WolframAlpha has done in its app.
It looks like you can replace the keyboard entirely, but the accesory view is probably the way to go. See the answer to Adding key to IPad keyboard
EDIT: For an example of how this would look, check out WolframAlpha's blog post on the subject. In your case the accessory view probably won't be quite so tall

How can I get the size of the keyboard on iPhone?

I want to get the keyboard size without using NSNotification. When I press the plus button, it can replace the keyboard with a custom UIView like this:
Then the plus button is pressed and the view loaded:
How can I achieve this?
I already made same rookie mistake like you want to do here. The problem is you will write a lot only to realize you do not want to avoid standard flow provided you by iOS team. For example you will definitely have a bad time dealing with issue like this one (there is additional bar which is part of standard keyboard for Chinese locale):
I solved this by using other people's work from DAKeyboardControl project. You do not need to attach observer (or if you use DAKeyboardControl - block) directly to your bar with buttons, but to your controller and check what user is trying to do and animate this bar accordingly. In the sources you can see how to get keyboard's animation duration and timing function. It may sound more complicated than it indeed is, just give it a try.

Does apple allow any customized keyboards?

I'm sorry if this is a "duh" question, but this is sort of compounded with this. I've figured out that I need a custom view that basically mimics the virtual keyboard on the iPad, but with a different set of keys (like both numbers and letters). Here's the issue: this app is something that will be sold, so what I'm wondering is whether Apple allows custom keyboards that just mimic the regular keyboard.
Absolutely. As of iOS 4, you can set the inputView property of any UIResponder (like a UITextField) to your own custom view, and the system will display that view at the bottom of the screen in place of the system keyboard whenever that view gets first-responder status.

Resources