Calling ViewWillTransitionToSize

BruceHamiltonBruceHamilton USMember ✭✭

If someone could take this Objective C example, or similar "template", and convert it to C#, I'll be ecstatic! I just can't seem to do it. I'm not calling it correctly, and have trouble with the context (the last part) for calling code after the rotation has finished.

    override func viewWillTransitionToSize(size: CGSize,  
                withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
    super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
    // Code here will execute before the rotation begins.
    // Equivalent to placing it in the deprecated method -[willRotateToInterfaceOrientation:duration:]
    coordinator.animateAlongsideTransition({ (context) -> Void in
        // Place code here to perform animations during the rotation.
        // You can pass nil for this closure if not necessary.
    },
    completion: { (context) -> Void in
        // Code here will execute after the rotation has finished.
        // Equivalent to placing it in the deprecated method -[didRotateFromInterfaceOrientation:]
    }) }

Best Answer

Answers

Sign In or Register to comment.