2

While working on a custom UINavigationController transition, I noticed something interesting: I create a copy of a UIView in my fromController, and add it to the transitionContext to do an animation, but it has a different value for safeLayoutGuides/Insets than the original in the the fromController. It has similar margins, though, differing only by the amount of the safeAreaInsets:

if let fromController = transitionContext.viewController(forKey: .from) as? WTPTransformingHeaderController
{
    // Make a copy of the from header
    let header_FromCopy = fromController.view_Header.copy() as! WTPTransformingHeaderView

    // fromController.view_Header.safeAreaLayoutInsets = UIEdgeInsets(top: 20.0, left: 0.0, bottom: 0.0, right: 0.0)
    // fromController.view_Header.layoutMargins = UIEdgeInsets(top: 48.0, left: 8.0, bottom: 8.0, right: 8.0)

    // header_FromCopy.safeAreaLayoutInsets = .zero
    // header_FromCopy.layoutMargins = UIEdgeInsets(top: 28.0, left: 8.0, bottom: 8.0, right: 8.0)
}

Exactly how does UIView set these properties? At what point in the view's lifecycle? I'm guessing it is determined by the view hierarchy somehow, but I cannot find specifics.

GoldenJoe
  • 7,874
  • 7
  • 53
  • 92
  • I know what the property is and how to use it. I am asking where specifically in the view's lifecycle it gets set. – GoldenJoe Nov 03 '17 at 07:12

0 Answers0