Search code examples
uiviewcontrollerxamarin.iosios6

ViewDidUnload and ShouldAutorotateToInterfaceOrientation replacements for MonoTouch


Now that viewDidUnload and shouldAutorotateToInterfaceOrientation have been deprecated with iOS 6, what should we replace them with in MonoTouch?


Solution

  • viewDidUnload

    Both viewDidUnload and viewWillUnload are not called anymore by iOS6. Xamarin's release notes for MonoTouch 6 covers this as well as Apple documentation.

    shouldAutorotateToInterfaceOrientation

    Two new methods (in iOS6, available in MonoTouch) can be overridden to get the same result. See Apple documentation for the shouldAutorotateToInterfaceOrientation selector for more details.

    Note that shouldAutorotateToInterfaceOrientation is still called (it's deprecated and discouraged for future use, but still available if you support older version of iOS).