Presenting / dismissing a modal view controller with custom animation does not render the view of the view controller below it

I have implemented a view controller that provides a navigation structure similar to the UINavigationController. It uses a controller constraint. All view controllers are added as children.

When I present a modal view controller from a view controller in this navigation flow, the main view disappears during the custom navigation and the user is left to view the window view below.

[UIView animateWithDuration:0.35 animations:^{

    self.view.transform = CGAffineTransformMakeScale(0.4, 0.4);
    self.view.alpha = 0.0;

} completion:^(BOOL finished) {
    [[self presentingViewController] dismissViewControllerAnimated:NO completion:nil];
}];

      

This is a very frustrating experience. Previously, this animation would shrink the view of the modal view controller and shrink it in the view of the view controller below it. As I said, the user is now exposed to a window view (which currently has no color values ​​set).

Referring to the View Controller documentation, I feel like I have set all the correct fields, however something is wrong.

The view controller presents another view controller when it wants to do a task. The view controller is responsible for this behavior. It customizes the presented view to the controller, gets the information from it, and eventually rejects it. However, while it is presented, the presented view controllers are temporarily added to the window view hierarchy.

My presenting view controller is my custom navigation controller, the presented view controller is a modal view controller that allows the user to compose a conversation. The root window controller of my application window is configured correctly for my custom navigation controller.

I also read a few more about presentation context and configured my custom navigation controller to have a PresentationContext as YES.

When a view controller is presented, the portion of the screen on which it skins is determined by the view context given to it by another view controller. The view controller that provides the view, the context does not need the same view controller that presented it. Figure 1-15 shows the same view controller hierarchy as shown in Figure 1-15. 1-14. You can see that the content view was representing the view controller, but it did not provide the presentation context. Instead, the view controller was represented by a tab controller. Because of this, even though the view controller only covers the portion of the screen provided by the tabs view controller, the presented view controller uses the entire area.the controller tab view. In my custom navigation controller, I do not overcome any methods related to presenting or firing view controllers. All child view controllers that are added are all added as childViewControllers and their views are added to this custom navigation controller.

  • Why does the custom transition render the window view instead of respecting the custom containment view controller that provides the presentation context?
  • Why do traditional transition animations work as expected?
+3


source to share





All Articles