我在设备方向上遇到了问题。我有一个iPhone应用程序,其中有一些视图,他们都不应该旋转,除了一个。所以我看了一下Info.plist内部;我选择了两个设备方向,肖像和lanscape,在视图中我不想旋转,所以我放了这个。
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return NO;
}但所有视图都会旋转。即使他们有这些台词。如果将Info.plist更改为不支持肖像。它工作得很好,只是我想要旋转的视图,我把
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}但它并不起作用。我用的是iOS 6。我也试过
- (NSUInteger)supportedInterfaceOrientations
- (BOOL)shouldAutorotate发布于 2012-10-01 23:19:11
尝试精确指定要将视图旋转到的方向。例如,如果您只想要画像,请使用以下命令:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}对于旋转到所有视图,您仍然可以使用YES,尽管这将允许它旋转到颠倒视图,这并不总是所需的。要同时获得横向和正面朝上的肖像,请使用以下命令:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}https://stackoverflow.com/questions/12676019
复制相似问题