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.
Related
By default, if you set a UITextField keyboard type to Number Pad when it is displayed, it appears on the bottom of the screen. My problem is, if the controller has a toolbar, they can not appear when the keyboard appears. I want the number pad to appear on above toolbar. Can I change the position of it?
Any ideas?
first
second
No, you're not able to change the position of the system keyboard. You can however put the toolbar on top of the keyboard. There is a property on UIKeyboard that allows this. Look at inputAccessoryView.
You should listen for the various keyboard events, such as UIKeyboardWillShowNotification and adjust the constraints/frame of your toolbar accordingly. This will allow you to place your toolbar wherever you want when the keyboard is shown and dismissed.
Reference: https://developer.apple.com/library/content/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html
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
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.
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.
I have a popover that contains a tableview (which is inside a navigation controller) with custom cells and a search bar in the header. Once I enter the search bar the popover shrinks appropriately to make room for the keyboard. Good so far. Once I dismiss the keyboard either by pressing the search button or the dismiss keyboard button, the popover appears to resize a little but does not does return to the full length as I would expect. I've tried all the suggestions to update the popoversize and contentsizeinpopover. They seem to have no effect.
Any thoughts or workarounds?
Thanks,
Rob