Posts

Post marked as solved
1 Replies
583 Views
To me it looks like the safe area of a view is not updated after the owning view controller's .viewWillDisappear() method is called. Is this intended or a bug in the framework? The issue is easily visualised by creating a custom UIViewControllerTransitioningDelegate that animates a smaller view in one view controller, to full screen size in another (constrained to safe areas). Then the safe areas will expand as the present animation goes on (as expected), but will not shrink as the dismiss animation goes on (not expected!). The expected behaviour would be that the safe area expands during the present animation, and shrinks during the dismiss animation. The gif below shows the unexpected behaviour. The grey area of the presented view controller is the safe area. I've attached the code I used to visualise this problem. ViewController.swift presents MyViewController.swift using FullScreenTransitionManager.swift FullScreenTransitionManager.swift MyViewController.swift ViewController.swift
Posted
by Smed1.
Last updated
.
Post marked as solved
2 Replies
449 Views
So, straight to the problem: I've created a custom UIViewControllerTransitioningDelegate that I use to animate a view from one view controller, to full-screen in another view controller. Im doing this by creating UIViewControllerAnimatedTransitioning-objects that animate the presented view's frame. And it works great! Except when I try to adjust the additionalSafeAreaInsets of the view controller owning the view during dismissal... It looks like this property is not accounted for when I'm trying to animate the dismissal of the view controller and its view. It works fine during presentation. So, what I want is: use additionalSafeAreaInsets to diminish the effect of the safe area during animation, by setting additionalSafeAreaInsets to the "inverted" values of the safe area. So that the effective safe area starts at 0 and "animates" to the expected value during presentation, and starts at expected value and "animates" to 0 during dismissal. (I'm quoting "animates", since its actually the view's frame that is animated. But UIKit/Auto Layout use these properties when calculating the frames) Any thoughts on how to battle this issue is great welcome! The code for the custom UIViewControllerTransitioningDelegate is provided as an attachment. FullScreenTransitionManager.swift
Posted
by Smed1.
Last updated
.