Forum Xamarin.iOS

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Calling ViewWillTransitionToSize

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.