Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 849
Jonas Stawski Avatar asked Sep 20 '12 19:09

Jonas Stawski


2 Answers

ViewDidUnload() you can just remove. If you have code in there, you'll have to move it into ViewWillDisappear() and the counterpart into ViewWillAppear(). Relevant talks from WWDC 2012 are episode 236 (The evolution of view controllers) and 200 (What's new in Cocoa Touch).

ShouldAutoRotateToInterfaceOrientation() is replaced by SupportedInterfaceOrientations(). See here: http://dhilipsiva.com/2012/07/25/ios-6-ui-interface-orientation-shouldautorotatetointerfaceorientation-not-working.html

like image 99
Krumelur Avatar answered Oct 02 '22 14:10

Krumelur


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).

like image 31
poupou Avatar answered Oct 02 '22 15:10

poupou