可能重复:
如何在特定视图控制器中强制屏幕方向?
你好
我想在一个特定的视图中设置方向,所以我该怎么做。和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 ];
}
}
}
但它完成的是整个应用程序,我只想在一个屏幕上完成,所以请回复谢谢