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.
Related
I've never seen a problem like this until now. When I first updated my app, this problem did not exist. It was fine. Since then there've been a couple of iOS updates, so it's possible this is where the problem began.
I basically have a few view controllers that proceed like a wizard from one step to the next, by either clicking back/cancel button or the next button.
There's a textView covering the main area.
Normally by touching inside the textView it would begin editing.
On this viewcontroller it's fine, that works. No problem.
On this viewcontroller and every subsequent view controller including tableviews with options to select, if you touch anywhere underneath the cancel and next buttons inside the view controller, it dismisses the view controller and goes back to the previous screen. There doesn't appear to be anything executed in my code when this happens. It just dismisses the view controller as if one pressed the back button. I know the back button code is not being executed because I printed a line in there.
The next view controller is a tableView and does not have a textView. It's got nothing to do with the textView. It just dismisses if I touch anywhere on the screen other than the next or cancel buttons. The next views are the exact same way. It's like a big invisible button is in the way of the screen blocking any interaction with the top half.
What's going on here? How do I fix this? It has never done this before and I didn't change anything.
Turns out that this was caused by using page curl transitions. I changed it to flip horizontal and it works now. Page curl transitions are obviously bugged currently.
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.
I have a rightBarButtonItem that slides up a view from the bottom of the screen like a UIActionSheet, and everything works fine except when I press a button that pushes a UIViewController and the rightBarButton almost at the same time, the two will both execute, thus resulting in a slide-up view over a screen that is totally unrelated.
Is there a way to get some notification or something so I can stop the view from animating when a view controller is being pushed, or the other way around?
With no code snippets its hard to understand what you are doing to cause this behavior. To me it sounds like you just need to restructure your button target actions. Why would u want to slide your button up from the bottom and push a VC at the same time if that will just hide the previously slid rightBarButton. Maybe just remove the slider code from the target action when that VC gets pushed.
There is a method you can call to stop animations your probably aware of.
- pushViewController:Animated:
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.
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;