I am using presentModalViewController:animated: and while functionally it works correctly visually it has an artifact I want to remove. When the modally presented viewController appears its parent viewController is completely hidden with the background turning black. This is not what I want. My child viewController's view is translucent and I want to reveal the parent viewControllers view behind it. The effect I want is a piece of tracing paper sliding over the background.
I assumed presentModalViewController:a开发者_JAVA技巧nimated: supported this. Is that not the case?
Thanks,
DougNavigationController and the View Controllers are designed in such a way that only one view controller may show at a time. When a new view controller is pushed/presented the previous view controller will be hidden by the system. So when you reduce the modal view's alpha you will possibly see the window's backgroundColor (the black color you see now).
If you want a translucent view to slide-in over the main view, you can add the view as the subView of main view and animate it using UIView Animations.
This may get you what you want:
presentingViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
presentingViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
doesn't work after ios7,you can fix it by after
presentingViewController.modalPresentationStyle = UIModalPresentationOverCurrentContext;
presentingViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
then both:
[appViews.rootViewController presentViewController:presentingViewController animated:YES completion:nil];
精彩评论