Visualization Bug When dismissing the keyboard in splitviewcontroller - ios

i have a split view controller with a search box on the left controller. I simply call:
[self.searchBar resignFirstResponder];
every time i want the keyboard to be dismissed (cell clicked, scroll bar scrolled and so on.)
When the keyboard is dismissed, the temporary effect is the one you see in the pictures, and then then the scroll bar resizes itself to the right dimensions.
Do you have an idea of the reasons of this behavior and tips on how to fix it?

Related

Keyboard flashes from opaque to transparent upon push

I have a view embedded in a navigation and tab bar controller. When a button is pressed, it pushes to (shows) the next view and I programmed the keyboard to immediately show for the first text field [textField becomeFirstResponder].
However, the keyboard will be opaque instantly then turn transparent in a little less than half a second. This happens no matter the keyboard type or keyboard look. I have no idea what is causing this, and I cannot find any answers anywhere else.
Other details: the navigation bar is translucent, and the bottom bar is hidden on the view we push to. The background is an image. This problem does not occur if I remove [textField becomeFirstResponder] and have the user just select the text field, but that is not what I am trying to do.
I have a similar scenario and also ran into this issue.
I am push-segueing between view controllers, and the keyboard has to stay up during the segue (textField.becomeFirstResponder() is called in viewWillAppear(_:)). The view controllers' background is white, but the keyboard look is Dark. During the segue, the keyboard is black, and then turns gray as soon as the segue finishes.
I came up with a workaround for that - it works if you want to have the keyboard opaque-ish at all times.
Add an empty UIView to the view controllers where you want to show the keyboard instantly, and set the backgroundColor of the view to match your keyboard's look (black for Dark, white for Light). Pin that view to left, right and bottom edges of the view controller's safe area superview. Add a height constraint to it equal to 0 and make an IBOutlet for it.
In your view controller, subscribe to KeyboardWillShow and KeyboardWillHide notifications and control the height constraint of the view you created - make it match the keyboard's frame height (the keyboard's frame end).
You will still see that during the segue, the keyboard stays opaque, but when the segue finishes and keyboard transparency kicks in, the effect is much less visible.
Ideal scenario for me would be to be able to turn off the transparency of the keyboard completely, but I don't think it's possible. I also think there is no way to make the keyboard non-opaque during the segue, so the only option is to make it look opaque at all times.

UIScrollView scrolls when clicking "Back" button in UINavigationBar

I have a UIViewController with a paged UIScrollView (3 pages). My View always starts at the second page, the middle one. The problem is that when I hit the back button in the UINavigationBar, the UIScrollView scrolls to the first page, and after that it disappears (popped from Nav Controller's stack).
The visible animation behaviour is horrible.
I want the UIScrollView not to scroll when I hit the BACK button in the UINavigationBar.
The same happens when I drag the left side of the screen to the right (triggers the BACK behaviour).
With some good debugging I noticed out that the scroll view wasn't scrolling during the "Back" transition. It was just part of the left pages that were visible during the transition.
So with a simple [scrollView clipsToBounds] the problem was solved :).

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.

iPad popover not resizing properly after search keyboard is dismissed

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

Resources