我想在定向时获得即时屏幕的旋转。在我的 ViewController 中有一个 UIImage 和一个 UILabel。我这样做:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
[self willRotateToInterfaceOrientation:[self interfaceOrientation] duration:0];
}
没有行应用程序不会崩溃:
[self willRotateToInterfaceOrientation:[self interfaceOrientation] duration:0];
随着代码行尝试将持续时间设置为零,应用程序在轮换完成后立即崩溃。
知道我做错了什么吗?
谢谢你。