MonoTouch的ViewDidUnload和ShouldAutorotateToInterfaceOrientation替换

Jon*_*ski 5 uiviewcontroller xamarin.ios ios6

现在,viewDidUnloadshouldAutorotateToInterfaceOrientation已经过时的iOS 6,我们应该在MonoTouch的替代它们?

Kru*_*lur 7

ViewDidUnload()你可以删除.如果你有代码,你必须将它移动到ViewWillDisappear()和对应的ViewWillAppear().来自WWDC 2012的相关演讲是第236集(视图控制器的演变)和200(Cocoa Touch中的新内容).

ShouldAutoRotateToInterfaceOrientation()取而代之的是SupportedInterfaceOrientations().这里:http://dhilipsiva.com/2012/07/25/ios-6-ui-interface-orientation-shouldautorotatetointerfaceorientation-not-working.html


pou*_*pou 6

viewDidUnload

双方viewDidUnloadviewWillUnload没有被所谓的iOS6的了.Xamarin的MonoTouch 6发行说明涵盖了此文档以及Apple文档.

shouldAutorotateToInterfaceOrientation

可以重写两种新方法(在iOS6中,在MonoTouch中可用)以获得相同的结果.看到苹果文档shouldAutorotateToInterfaceOrientation选择更多的细节.

请注意,shouldAutorotateToInterfaceOrientation仍然会调用它(它已被弃用并且不鼓励将来使用,但如果您支持旧版iOS,则仍然可用).