I have a UIWebView in a modal view controller (using SVModalViewController). In iOS 4.2, when I tap on an input text field, the keyboard does not appear. The view animation where the page scrolls to make room for the keyboard still happens, but nothing appears. It works fine in iOS 5.
I am calling [self.window makeKeyAndVisible] in the application delegate, so that is not the issue.
Any guidance would be very much appreciated!
Solution: I needed to make the view controller containing the UIWebView the first responder, and after that, it worked!
Related
I have a UIMenuController which is presented when a UIView is tapped. I have implemented the canPerformAction and canBecomeFirstResponder methods, and it works when the view is first loaded. The app is navigated by a tab view, and if a user is to switch to another view and then back to the first (although the same issue occurs if a modal view is presented from the first view), the UIMenuController will no longer show up. Any ideas as to why this could be?
I just worked out the answer: I have to manually call becomeFirstResponder on my view in order for it to work.
I am working on iPad application where I am showing some view in modalView controller.
In Landscape, when I click on UITextField for taking some input modalview controller goes up and keyboard appears.
But I have changed the height of modalViewController and I dont want the modalView goes up for keyboard. How can I do this? Any help?
In the UIViewController's code, where you move its modalViewController, check if the interface orientation is not landscape
if(([self.interfaceOrientation!=UIInterfaceOrientationLandscapeLeft])
&&([self.interfaceOrientation!=UIInterfaceOrientationLandscapeRight]))
//your code to repostion the view controlled by the modalViewController
I guess you have to use custom presentation code. You cannot change the scrollup behaviour, when the keyboard appears.
You could add a 1024*768 sized black transparent view on top of the window and then your view on top of this. But you would have to build your own borders around your view in that case. Probably there are some open-source implementations of a modal popover. You can search for that on cocoacontrols etc.
I am not able to hide the keyboard in my app.
My app has 2 view.., The first view loads the another view. But when I do resignFirstResponder.., nothing is working...
are you calling resignFirstResponder on a text component, like a UITextField or UITextView? Calling it on the containing view won't work.
I have a Modal View Controller presented as a Form Sheet in Landscape on an iPad. When I dismiss the view, the view jumps to a different location, as in this thread:
A modal VC with a keyboard on landscape changes location when dismissed:
Modal View Controller with keyboard on landscape iPad changes location when dismissed
The response to that thread is to call resignFirstResponder, however, you are not allowed to dismiss keyboards when using a Form or Page Sheet:
Modal Dialog Does Not Dismiss Keyboard
Has any one else had this problem? Is there a way to either force the keyboard to be dismissed or force the view into a nice position when it's being animated away?
Cheers,
Nick.
The keyboard will be removed only after the modal form is dismissed. Apple has the idea that if you are using modal form, then you'll need the keyboard for multiple fields therefore it shouldn't be removed.
I have a paged scrollview. Each page has a viewcontroller (buttonViewController) that manages a grid of buttons. If you press one of the buttons, the buttonViewController pops up another viewcontroller (detailViewController) modally.
The problem is, when I dismiss the modal view controller, the visible buttonViewController is shifted down by what looks like about 20 pixels. The weird thing is that only the visible page is shifted. If I scroll over to another page that is already loaded, it is still in the correct position.
My question is basically the same as dismissing modalViewController moves main view buttons around iphone
However, the accepted answer to that question assumed that the status bar is hidden. I am not hiding the status bar in my application.
Any other ideas?
One more note: The shift only happens the first time I launch a modal view controller. If I keep opening and closing the modal view controller, everything stays the same.
One further note: if I add the following code:
CGRect frame = self.view.frame;
frame.origin.y=0;
self.view.frame = frame;
after I dismiss the modal view controller, then I can work around the problem. The frame seems to move by 20pixels in y. I still don't know what's causing the move though.
Well I had this problem and it was due to the way my first viewController was set up (on the UIWindow), it is very weird since this had never happened to me before, the behavior I was observing was that when you add a subview at point (0,0) it would overlap with the status bar, which is not usual, usually the views know about the status bar and they behave appropriately. As a side effect, when one pushes a modal view that takes off the status bar, after dismissing it I saw the same problem you are seeing. What I did to fix was to set the UIWindows view to my controllers view in the nib, this seemed to fix everything. Once again I don't know why simply adding to the window programmatically with CGRectMake(0,0,320,460) had this odd behavior, since I have been doing this for all my previous projects and saw the correct behavior. But when I set it up in the nib, it worked as expected. Maybe this is your problem as well.
Turns out this was related to:
ModalViewController doesn't display during animation when paged scrollView is scrolled
I had mismatched the heights of some of my viewcontrollers, and that was throwing everything off.
Some of the views had heights of 460pixels, some had 480pixels. For some reason, this made it shift by 20pixels evertime a modal view controller disappeared. Once I made everything 460pixels, everything worked great.