旋转 iPhone/iPad
我发现旋转会使我的应用程序崩溃。
当您将设备握在手中时,稍微移动一下,应用程序就会记录所有这些微小的动作,相应地改变方向,并且看起来应用程序很忙。一切都变慢了。
另外,当我滚动某些内容并同时更改方向时,滚动会停止。
这件事该如何管理?
编辑:
public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation) {
if (UIDevice.CurrentDevice.Orientation == UIDeviceOrientation.FaceUp ||
UIDevice.CurrentDevice.Orientation == UIDeviceOrientation.FaceDown)
{
return false;
} else {
return true;
}
}
I found out that rotation makes my app crash.
When you hold the device in your hand, you move it a bit and app registers all of those tiny movements, changing orientation accordingly, and it looks as app's busy. Everything slows down.
Also, when I scroll something and simultaneously change orientation, scrolling stops.
How can this things be managed?
EDIT:
public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation) {
if (UIDevice.CurrentDevice.Orientation == UIDeviceOrientation.FaceUp ||
UIDevice.CurrentDevice.Orientation == UIDeviceOrientation.FaceDown)
{
return false;
} else {
return true;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那段代码不会导致您的崩溃,看起来很好。您需要使用调试器运行并找出异常在哪里,然后找出异常的原因。否则我们只是在黑暗中猜测。
That bit of code is not causing your crash, it looks fine. You need to run with the debugger and find out where the exception is and then figure out why it gets an exception. Otherwise we are just guessing in the dark.