View is blank after modalViewController is dismissed - iphone

I am using PPRevealSideViewController and I am showing a ViewController modally after user taps a cell in a side view. When I dismiss a modal view controller, the view, where user tapped, is shown blank. Only after I move a little bit side view, it is shown again (refreshed). What might be the problem?

This was a side effect of your preload call on viewWillAppear or DidAppear in fact. The view should not be preloaded if shown. I added this behavior as default into the controller.
But the idea behind was to test if [self.revealSideController sideDirectionOpened] != PPRevealSideDirection from the side you are trying to preload.
Fixed right here https://github.com/ipup/PPRevealSideViewController/commit/a1ca242422f0a8b4666df5987ca4a020f869bb99

Related

Keep UITextField as first responder when pushing new view controller

Is there any way to keep a UITextField first responder even as I push another view controller?
Essentially, I'm taking a screenshot of the screen, using that screenshot in the new view controller, and then popping the second view controller. The issue, though, is that it isn't a smooth transition; when the view controller pops, the keyboard in the picture disappears (since the picture was in the second view controller but has since been popped), but the actual keyboard hasn't reappeared yet. You see the keyboard sliding up just after the picture disappears. Is there anyway to prevent this such that the keyboard is just always there?
I don't have any other UITextFields in the new view controller, only the screenshot, a UIButton, UIScrollView, and two UIGestureRecognizers.
Thanks in advance!

PresentModalViewController, PushViewController, then DismissViewController with a new view shown?

I have a UINavigation controller setup. I was hoping to do this:
From one of the views, I presentModelViewController:animated:, the user selects one of three options, after selecting I want the UINavigationController behind the modal view to change (the user will not see this), then I want to dismissModalViewControllerAnimated to reveal the new view.
Is this possible using the built-in modal view? Or will I need to create a view, add/animate it to the rootViewController so its not in the same stack as the UINavigationController?
Thanks!
A modal view is a view you show modally on top of another view to interrupt the user from the current task. If I understand you correctly, you need two modal views and the selection user make on first modal view will decide what will show as the second modal view. Is that right?
If that's the case, you can make your main view to be the delegate of your first modal view, and send data back to the main view when the user makes a selection, and then main view dismiss the modal view (it's the main view's responsibility to dismiss it). And then based on user's input, you create another view and pop it modally. To make it animate correctly, you need to set the animation of the dismissing of the first modal view to be NO, and then make the animation of populating second modal view to be YES.
Hope this helps.

How to get the animation right: inputView from a UINavigationController's nav bar?

I have a custom UIControl subclass with a UIPickerView as inputView. When the control is tapped, it calls becomeFirstResponder and the picker view automatically slides up from the bottom of the screen, like the system keyboard. This is working great!
The problem is that I am using the custom control as the titleView of a UINavigationItem. It functions properly, but if the view controller is popped off the navigation controller stack while the picker view is visible, the animation is wonky.
What I want to happen:
everything is pushed off screen to the right at the same time
What actually happens:
first, the background view and navigation bar slide off screen, the picker remains in place
then, after they are gone, the picker slides off to the right also
When I use the custom control inside the view controller's main view, it animates away just like the standard keyboard. So it seems as though this is a function of "coming from" the navigation bar, which is animated separately from the views inside.
How can I fix this, so that the inputView slides out with the rest of the content?
Turns out this can be fixed by calling endEditing: on the UINavigationController's view. In other words, within a view controller:
[self.navigationController.view endEditing:YES];
This causes the input view to slide down while the rest of the view slides off to the right. Not exactly the same as the system keyboard, but not obviously weird.

Bad animation when dismissing modal UIImagePickerController

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.

iPhone, is it possible to remove the back button and make a view slide up?

I have a view which I'm reusing (its a date range selection screen) it elsewhere in my app, its the only view and there isn't any other views to navigate too. So theres no back button.
I'm trying to reuse the screen to select a date range in another part of my app. I call it from a done button on the previous view. However, I'd rather it appeared like a dialog. Also my title is too big and if I have a back button it doesn't fit.
So can i remove the back button, is my main question?
Also can i make the view slide up from the bottom of the screen ?
You can present the view modally by putting it in another view controller and having it slide up from the bottom of the screen like so:
[self presentModalViewController:modalViewController animated:YES];
The default is sliding up but you can change it with the modalTransitionStyle property of the modal view controller.
Using a modal presentation may fix your first problem as well, since you will need a whole view controller rather than just the view and it will cover the entire screen.