Present UIPopoverController from a moving rect - ios

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

Related

iOS How to put scrollView inside scrollView but not allow the internal scrollView to scroll the external?

In my app I have a modal View Controller that gets dismissed by dragging the screen down, but in the center of that screen I have UITextView. The problem is that when I scroll to the top of the textView and drag its content down the View Controller gets dismissed. How can I avoid that? I would like the external scrollView to scroll independtly of the textView.
I used title like that because I suspect it's the same problem, but please correct me if I'm wrong

How to scroll within a ScrollView while keyboard is present?

I have a ScrollView and two buttons, one is at the top of the view and the second one is set lower than the height of the keyboard. By changing the inset, I now have the ScrollView move up once the second button is pressed and the keyboard is shown. However, after I press the second button and the keyboard moves the ScrollView up, I want to scroll the view up with a touch to be able to see the first button (without closing the keyboard). But whenever I try to pull it up the keyboard disappears. Any thoughts?

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.

How do I make my UITextView autoscroll when dragging caret to the edge of view?

In the iOS's Notes app, I wrote very long text on the TextView,
then I long press on the view, bring up the magnifier loupe, drag it to the bottom of screen (or top of the keyboard, if it is activated), the TextView will automatically scroll up.
How can I implement this with UITextView?
I tried
Add a UILongPressGestureRecognizer to my UITextView subclass, but its action never get called.
Override touchesMoved:withEvent: method in my UITextView subclass, but this method will not be called after the magnifier loupe appears.
You don't implement it; that's standard behaviour.
The magnifier scrolling occurs when you drag the magnifier off the bottom or off the top of the UITextView, or when you're close on the edge, about 10 pixels? (best to test this in the simulator where to have exact-control over the touch-position). If your text view is full-screen you may not be able to drag to a position outside the view, and the touch-region for scrolling may just be too small.
Notice in the Notes app that to scroll down you can drag the magnifier onto the tabs at the bottom. To go up you can drag it into the title. So long as you hold the touch outside the view it'll scroll.
All this also means your view can't go behind the keyboard when it's present. You need to resize the UITextView when the keyboard appears to get the scrolling to work.

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