Custom iOS Keyboard - ios

I want to add a keyboard icon to the bottom left grey square on UIKeyboardType.NumberPad. How can this be done?
Some ideas I have went through.
class that conforms to UITextInputTraits I couldn't figure out what was required to satisfy the protocol.
UIButton above the keyboard
subclass of UIView and not use a keyboard at all. This one seems the hardest.

If you want to show a custom view in the bottom, you have to add a subview to the keyboards window view so it overlays the keyboard.
The Keyboard is shown on a separate window UIRemoteKeyboardWindow
Run this code AFTER the keyboard gets shown:
let view = UIButton(frame: yourFrame)
UIApplication.sharedApplication().windows.last?.addSubview(view)
It's the cleanest solution that requires the least work.

Related

AirPlay Button Custom Sizing

I have an Airplay Button which I have created by subclassing a UIButton to AVRoutePickerView in Storyboard. It's showing the button and also showing the view when tapped. I am unsure how I can change the size of the icon though. Have I created the Airplay Button incorrectly or am I just missing something?
I don't think you want to use a UIButton. An AVRoutePickerView is a UIView, not a UIButton. It creates a UIButton and inserts it as a subview of itself. That's the button you want to resize.
You can access AVRoutePickerView's button by doing this hackery:
let button = routePickerView.subviews.first(where: { $0 is UIButton }) as? UIButton
You can then experiment with changing its frame size... maybe directly or via constraints.
Just beware that this hackery isn't future-proof. Apple could change how it manages the button in the future.

UITextField and Button as TabBar

I want to add UITextField and Button as this picture. I think that its position is fixed and It will scroll up when keyboard appeared. I'm wondering it's kind of tableFooterView or what else?
This is a UITextField input accessory view.
It has nothing to do with UITabBar or table view, just a plain old UIView put on top of each and every other view.
When UITextField on the view becomes firstResponder, you should put it over the keyboard and vice a versa.
UITableViewFooter is not an option here - at least look at Facebook or Instagram, it's done differently there.

How to fix the position of a UIPopoverController?

I have a UIPopoverController and a UITextfield embedded in it. When I tap the text field, the keyboard pops up and my popover controller shift up a bit to make space for the keyboard. But I want my popover to stay in the same position no matter if the keyboard is present. How can I do this?
The Apple popover controller adjusts itself to appear above the keyboard, and you cannot change this behavior. You only options is to either roll your own implementation or use an open-source popover implementation.

Preventing keyboard cover AdBannerView and toolbar

I added the AdBannerView and toolbar to my IOS drag and drop from object library i get problem because it is on fixed position under my UIwebview when I click on my webview to type it will cover AdBannerView just I want to ask how can I fix the problem
the keyboard cover the AdBannerView and toolbar
Can you listen to the UIKeyboardDidShowNotification notification, and resize the view or move the adbanner view accordingly.
see how to do that in the following question:
How to detect when keyboard is shown and hidden

uitextview keyboard appear above uitoolbar

I have a uitoolbar at bottom of my main view. I also have a uitextview at top of my view. when tapped on the textview to start editing I want the keyboard to appear from above the toolbar, not covering the tool bar. I want to know how I can do that also I don't want it to be animated.
I have one more question, when the keyboard appears is it possible to put another view in front of it?
thanks
You can't do the former. The keyboard is in a different window and so doens't interact with the views in your window. Apple doesn't provide any public access to the keyboard window.
As to the latter, putting a view in front of it, you might be able to something like that by creating another window but I've not seen anyone do it and not sure what it would do to the keyboard events, etc.

Resources