When I present a modal view in iPad, the view comes up from the bottom. But when I dismiss it, it slides of the screen to the left. I'm in landscape mode and using UIModalPresentationStylePageSheet. How do I make the dismiss animation slide the view back down?
See a different solution here: Modal View Controller with keyboard on landscape iPad changes location when dismissed
Related
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.
When I switch my iPAD to portrait mode the navigation bar buttons button appears correctly. Now If i choose a table row from popOver View and push a new screen for the master and detail view the navigation bar button disappears and wont appear until I rotate the device to Landscape and then back to Portrait. Does anyone have a idea how to fix this ?
Perhaps you are not setting the delegate in the UISplitViewController
self.delegate = secondViewController;
I have a UIViewController (A) that modally presents a second view controller (B). Then, that second view controller modally presents a UIImagePickerController (IP). Basically, I have a stack of 2 modal view controllers.
(A) --modally presents--> (B) --modally presents--> (IP)
View controller (A) is the delegate of the image picker, and it dismisses the entire modal stack using:
[self dismissModalViewControllerAnimated:YES];
The problem is with the animation. When dismissing a modal stack like this, the currently visible view should slide off the bottom of the screen, revealing the newly visible view. So in this case, I expect (IP) to slide off the bottom of the screen, revealing the view for (A).
However, what actually happens is this: The image picker view simply disappears, immediately revealing the view for (A), and only the navigation bar animates off the bottom of the screen. The status bar is also left as black translucent instead of transitioning back to a standard gray; this seems to indicate that the image picker normally does some kind of "cleaning up" that isn't being performed when it's dismissed as part of a modal stack.
If I replace the image picker with another generic view controller, the animation works fine. If (IP) is dismissed by (B), the animation also works fine. The problem seems to occur only when dismissing multiple modal view controllers containing UIImagePickerController.
Has anyone seen this before? Any ideas what I might be doing wrong or how to work around this?
Unfortunately, the method dismissModalViewControllerAnimated does not work exactly as you would expect (at least not visually). To achieve what you want, you need to dismiss both modal viewcontrollers in a row, the first non-animated and the second one animated, as described e.g. here.
In my iphone app, i've two view controllers. First one is a portrait and second one is landscape.
When app is started, it will show the portrait view. On click of a button in portrait view, the view transitions to landscape view. Here, i'm using navigation controller.
If both the views are portrait, pushing the next view via navigation controller won't be a problem. How can I achieve transition between portrait and landscape views using nav controller.
Note that status bar is visible and nav bar is hidden.
I would suggest you to use the following instead of pushViewController
[self presentModalViewController:aController animated:YES];
This is the only solution i guess. If you are navigating further from the LandScape mode put the aController inside the UINavigationController and Present the NavController the same way as shown above.
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.