C# IPad视图不旋转
到目前为止,我有一个非常简单的应用程序,它不会旋转视图<代码>ShouldAutorotateToInterfaceOrientation在应用程序启动时被调用,但在我旋转时不再调用。我的代码如下:C# IPad视图不旋转,c#,ipad,ios,xamarin.ios,C#,Ipad,Ios,Xamarin.ios,到目前为止,我有一个非常简单的应用程序,它不会旋转视图ShouldAutorotateToInterfaceOrientation在应用程序启动时被调用,但在我旋转时不再调用。我的代码如下: public class NotebookSelectionController : UIViewController { public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toIn
public class NotebookSelectionController : UIViewController {
public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation) {
return true;
}
}
public override bool FinishedLaunching(UIApplication app, NSDictionary options) {
var notebookController = new NotebookSelectionController();
window.AddSubview(notebookController.View);
window.MakeKeyAndVisible();
return true;
}
我的应用程序代理代码如下所示:
public class NotebookSelectionController : UIViewController {
public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation) {
return true;
}
}
public override bool FinishedLaunching(UIApplication app, NSDictionary options) {
var notebookController = new NotebookSelectionController();
window.AddSubview(notebookController.View);
window.MakeKeyAndVisible();
return true;
}
我遗漏了什么???它在模拟器中工作吗?例如,当您在模拟器中打开菜单硬件/向左旋转时?如果它在那里工作-使用开关或在“多任务”栏中检查设备上的自动旋转是否没有被iOS关闭 我犯了很多次愚蠢的错误:) 除此之外,这没有理由不起作用,这是正确的调用