【发布时间】:2011-08-23 01:12:59
【问题描述】:
可能重复:
How to force a screen orientation in specific view controllers?
你好
我想在一个特定的视图中设置方向,那么我该怎么做。和body有例子。我用了
-(void)onUIDeviceOrientationDidChangeNotification:(NSNotification*)notification{
UIViewController *tvc = self.navigationController.topViewController;
UIDeviceOrientation orientation = [[ UIDevice currentDevice ] orientation ];
tabBarController.view.hidden = YES;
// only switch if we need to (seem to get multiple notifications on device)
if( orientation != [[ UIApplication sharedApplication ] statusBarOrientation ] ){
if( [ tvc shouldAutorotateToInterfaceOrientation: orientation ] ){
[ self rotateInterfaceToOrientation: orientation ];
}
}
}
但它完成的是整个应用程序,我只想在一个屏幕上完成,所以请回复 谢谢
【问题讨论】:
-
你想为你的应用应用单一方向吗???
标签: iphone uiinterfaceorientation