pop view controller with enabled/open keyboard in ios 8 - ios

i am trying to implement some chatroom-like view controller (e.g. Messages-app on iPhone), and i would like to keep the keyboard enabled/open when this (chatroom-like) view controller gets dismissed and therefore gets popped from the stack, BUT dismiss it together with the view, i.e. sliding it out of the screen together with the chatroom-view-controller.
For the desired effect, just open the Messages-app on the iPhone, go into one chatroom/conversation, set the focus on the input-textfield so that the keyboard comes up, but then go back to the last view without dismissing the keyboard.
I always get this weird animation that the chatroom-view (-controller) is sliding out of the screen to the right (which is desired), but the keyboard gets dismissed to the bottom of the screen...
Does anyone know what I am doing wrong? I have already tried it with so many versions, from become/resign first responder in all the different view will/did appears...
My assumption is that it could have something to do with my custom pan gesture recognizer for popping the chatroom-view-controller from the stack of the navigation controller, but neither the docs nor the web contain such issues...

you don't need to keep your keyboard visible, instead you can make snapshot of chatroom controller right before it being dismissed.
Edit: I just created simple app with navigation controller which pushed controller contains text field. Then on app tried to pop that controller when keyboard is visible. And..all view was dismissed together with keyboard, so your wanted behaviour is given by default.

Related

iOS modal interactive dismissal freezes

I have created a UIPercentDriven Transition which modally presents a popover view containing a tableView. Then, following stack exchange posts such as this one: In iOS, how to drag down to dismiss a modal?, I added a panGestureRecognizer to control the dismissal of the modal view. Then, I attempted to add functionality so that the user can continue to swipe downward once the tableview has reached the top to trigger the percent driven transition.
Here is a link to the project on github:https://github.com/KaplanAlex/modalViewDismissal
This transition was based on moving the frame of the modal view off of the screen. I also created the transition by using snapshots (which is commented out in the github project) and have the same issues. For some reason, the interactive dismissal works well unless the user moves the modal view back up after starting the dismissal and then continues to swipe upward after the modal view has reached the top of the view, the entire application seems to freeze. It doesnt crash, but also doesnt respond to taps anywhere on the screen. Even cancel button cannot be pressed. Has anyone encountered this issue before? Thanks for the help.

Hide keyboard with dismissViewControllerAnimated

The user taps a button to bring up a view controller with a keyboard. In this case, the keyboard slides up with the view controller so it looks like the keyboard is fixed into the view controller.
Upon completion, the user hits "done" or whatever, the keyboard is dismissed, and view controller slides away with dismissViewControllerAnimated. However, even though both hide, the keyboard hides at a slightly lower rate than the view controller. This looks slightly strange, in my case, and doesn't go along with the idea that the keyboard is fixed within the VC.
How can I fix this? Somehow, I need to make the keyboard slide down as the same rate as the view controller. Thanks in advance.
You will have an easier time doing it the other way: making the view controller go along with the keyboard. That's easy, because (1) the keyboard tells you its animation duration and curve, and (2) you can customize the view controller animation to match it.

(iOS) don't move up a modal view when the keyboard appears [duplicate]

I have a viewcontroller from here I am getting a popover. From this popover i am presenting a view as modal view.
There is a textview in it. When editing begins, the entire modal view moves up (which usually people desire). But I do not want it that way.
Is there any way, i can block my modal view from moving up and down on keyboard show and hide ?
If I guessed correctly then you need to set
yourviewControler.modalPresentationStyle=UIModalPresentationPageSheet;
instead of what you are probably using right now
yourviewControler.modalPresentationStyle=UIModalPresentationFormSheet;

present view on part of screen; disable surrounding views but keep them visible

When the user presses a button, a text view should pop up in the middle of the screen. Two requirements:
1) Whatever was displayed before should still be visible (except where covered by the text view or keyboard).
2) If the user taps outside the text view or keyboard, nothing should happen.
I thought that if I presented the text view in its own VC, that would address #2, because I think that's how modal presentations work. However, when I do this, even though I set the background of the text view's VC to transparent and tried reducing the frame, all I get is the text view surrounding by black. Nothing is visible behind the presented VC.
EDIT:
It has come to my attention that apparently when you use a tab bar controller, that object does all of the presenting, no matter what VC actually sends the present message to itself. I am using a tab bar controller. Maybe this is part of the issue and forecloses the option of using presentViewController. So I need a different method!
You can just add a transparent view the size of the whole screen and put your textView in that. The transparent view won't allow touches to pass through. Then whenever the user is done entering text, you can just remove that transparent view (and the textView along with it) from its superview.

don't want the modal view to move up on keyboard show

I have a viewcontroller from here I am getting a popover. From this popover i am presenting a view as modal view.
There is a textview in it. When editing begins, the entire modal view moves up (which usually people desire). But I do not want it that way.
Is there any way, i can block my modal view from moving up and down on keyboard show and hide ?
If I guessed correctly then you need to set
yourviewControler.modalPresentationStyle=UIModalPresentationPageSheet;
instead of what you are probably using right now
yourviewControler.modalPresentationStyle=UIModalPresentationFormSheet;

Resources