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

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;

Related

Should I dismiss keyboard before dismissing the view?

I have two UIViewControllers, on modally presented over the other. The first controller is orientated in landscape, and the modal view is presented in portrait.
When dismissing the modal view, the view animates to reveal the landscape view below. If the keyboard is visible on the modal view at this time, it will suddenly attach itself to the left or right side of the screen to match the orientation of the soon-to-be active viewController.
Is there a way to let the keyboard disappear in the same orientation as the disappearing viewController? Or should I perhaps dismiss the keyboard before dismissing the modal view controller? In that case, what would be the best approach?
I do have an action for when the user clicks 'close'. I can there check if any objects are firstResponder, and start a timer for ~0.4 seconds before dismissing.. But it would obviously create a kind of delay that wouldn't feel all that natural.. I'd prefer a way to let the keyboard stay attached to the same orientation as the dismissing view.
This is happening:
I think the best practice would be to dismiss the keyboard before dismissing your modal ViewController. The keyboard is presented over your content and should be removed first before removing other items in the view hierarchy.

pop view controller with enabled/open keyboard in ios 8

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.

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;

iOS connect my view to popup on button press

I have two xibs, one is my title screen with buttons, the other is a more specific window that should come up when one of the buttons is pressed.
This isn't switching the whole screen, just a popup window, where clicking outside of the bounds of that window will make it disappear leaving only my title screen remaining as it was visible behind this popup view. This is similar to my understanding of "modal views".
Anyway I do not quite get how to connect it to the button on my title screen. I have the views made in IB ready to go. I'm not sure if I have declared all objects to satisfaction yet.
From what I understand I think I need a UIViewController or something, but its all a pretty thick fog of information right now
insight appreciated, or links to proper noob sources would be helpful
Does your title screen have a view controller (or is your app delegate the main controller object)? You will want to add an IBAction to that object, connect the button to it, and then present your other view controller modally (or in a popover) from there.
A popover will appear in a small window with an arrow, and tapping outside will close it. A modal view controller typically slides up into place, and you have to press a cancel button to close it. This guide explains how to use a popover. Using a modal view controller is simple if you have a view controller: [myViewController presentModalViewController:nextViewController animated:YES].

UIPopover locking background view

I am trying to replicate the iPad passcode view. Which basically is a popover with no arrow direction, that locks the background view kinda like a modal view controller.
My question: Is there a way to lock the underlying background view when presenting a popover.
My idea: The only real solution that i could come up with is placing that popover inside a modal view controller. and presenting it that way.
Thoughts?
Use the modalInPopover property of your view controller: http://developer.apple.com/iphone/library/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006926-CH3-SW72
This question provides some information on making a popover with no arrows, though it's not clear whether it's correct or not: UIPopover without any arrows

Resources