How to prevent popover scaling when keyboard appears? - ios

My iPad app has a popover with a few UITextFields at the top half.
When tapping a textfield, which makes the keyboard appear, iOS scales (and moves) my popover. I don't want that.
How do I prevent iOS from doing that?
This answer suggests to override some keyboardWillShow() and keyboardWillHide() functions, but it's unclear where these are defined.

Related

How to show stickers (or other views) under UIInputAccessoryView on iOS?

I'm building a chat interface and I'm curious how apps like Telegram and iMessage achieve the following:
There's an always-on input bar that stays above the keyboard (or at the bottom of the screen if there's no keyboard). This is most likely a UIInputAccessoryView, and I've got this implemented.
There's a sticker button on the bar that, when tapped, dismisses the keyboard AND keeps the input bar in-place AND reveals another view under it that is some other view (containing stickers, etc.) The input bar basically doesn't move at all. The animation is exactly like the keyboard going away, revealing the view that appears to have always been there.
If the keyboard is hidden, tapping on the sticker button does the same as 2. What's really cool is that the sticker view is always the same height as the keyboard - and note that keyboards of different languages can be of different height (autocomplete bar), and at least in Telegram's case it can always find the right height.
Any pointer to how to achieve this is appreciated!

Keyboard does not dismiss interactively

On an iOS app, I have the following view structure:
UIViewController > UIView > UIScrollView > UITextView
The UIScrollView has the "Dismiss Interactively" setting. When I tap on the UITextView, the keyboard pops-up properly. However I now try to gradually dismiss the keyboard by slowly swiping my finger down, but nothing happens.
Did I forget anything in my configuration ?
Example project
Since iOS 7, you can use
scrollView.keyboardDismissMode = .Interactive
The keyboard follows the dragging touch offscreen and can be pulled upward again to cancel the dismiss.
Issue was linked to the fact that the scrollView contents were shorter than the screen size.

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.

Present UIPopoverController from a moving rect

Just got this weird problem, where I have a scroll view and buttons in the scroll view. I want to display a UIPopover from the button when touched, with UITextFields inside the UIPopover. The problem comes when the Keyboard appears. In certain cases, when the UIButton is so high in the view that the popover can only be displayed under it with the UIPopoverArrowDirectionUp, and when keyboard pops in, this popover cannot move any more up and therefore magically disappears to the top left corner (probably some Apple thing).
My solution is to check the frame of the UIPopover and to check that there is enough space for the keyboard, and if not, scroll the UIScrollView up with the buttons as well in order to be able to push the UIPopover up and so make sure that both the Keyboard and the popover fit.
So the question is: Is it possible to move the popover as the button moves?
Thanks

Adjust UIPopover when the iPad keypad splits

I have an iPad app in landscape orientation.
Which has multiple UIButtons on the screen from top to bottom which present a UIPopover with a TextView in it.
When the keyboard appears and covers the button, the popover moves over the keyboard, and comes back nicely when the keyboard is dismissed.
but when the keyboard is suddenly put into split mode and if the popover was for a button below the keyboard then the popover comes back and goes behind one of the halves of the keyboard.
How should such situation be handled gracefully ?
Would creating a transparent view/button that you launch the Popover view from work? Then you could move the button to where ever you want.

Resources