0
我正在尝试从纵向屏幕调用横向屏幕的代码。 当前屏幕方向为横向时,将不允许任何自动旋转。如何禁用任何自动旋转?
我试过下面的代码:
// Override to allow orientations other than the default portrait orientation.
/*- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}*/
- (void)viewDidLoad {
[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight;
CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(degreesToRadian(90));
landscapeTransform = CGAffineTransformTranslate(landscapeTransform, +90.0, +90.0);
[self.view setTransform:landscapeTransform];
}
但上面的代码允许UIInterfaceOrientationLandscapeRight。
如何禁用任何自动旋转?
在此先感谢。
感谢您的回复。旧版本更好。 但是,这允许纵向模式的肖像模式。我试图让它不会有任何方向。 周期是:开始 - >肖像 - >风景 - >结束。 – Ferdinand 2010-02-22 03:33:59