just a little confused on how to disable autorotation in all views except one. I am using FGallery
and i only want to enable rotation on that view.
只是有点混淆如何在除一个视图之外的所有视图中禁用自动旋转。我正在使用FGallery,我只想在该视图上启用旋转。
Can anyone tell me how to proceed?
谁能告诉我怎么办?
2 个解决方案
#1
1
For iOS 5.x you can implement this method from UIViewController
, only returning YES
for your supported orientation:
对于iOS 5.x,您可以从UIViewController实现此方法,仅为您支持的方向返回YES:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
For example, to only support portrait:
例如,仅支持肖像:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
return YES;
}
return NO;
}
Note that this method is deprecated after iOS 6.
请注意,此方法在iOS 6之后已弃用。
#2
0
have you implemented the shouldAutorotateToInterfaceOrientation:interfaceOrientation method in your view controller?
你在视图控制器中实现了shouldAutorotateToInterfaceOrientation:interfaceOrientation方法吗?
if you return no to everything except the orientation you want that should get you the desired result.
如果你没有返回除了你想要的方向以外的所有东西,那么应该得到你想要的结果。
#1
1
For iOS 5.x you can implement this method from UIViewController
, only returning YES
for your supported orientation:
对于iOS 5.x,您可以从UIViewController实现此方法,仅为您支持的方向返回YES:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
For example, to only support portrait:
例如,仅支持肖像:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
return YES;
}
return NO;
}
Note that this method is deprecated after iOS 6.
请注意,此方法在iOS 6之后已弃用。
#2
0
have you implemented the shouldAutorotateToInterfaceOrientation:interfaceOrientation method in your view controller?
你在视图控制器中实现了shouldAutorotateToInterfaceOrientation:interfaceOrientation方法吗?
if you return no to everything except the orientation you want that should get you the desired result.
如果你没有返回除了你想要的方向以外的所有东西,那么应该得到你想要的结果。