我有一个基于 xcode 4.2 构建的应用程序,它仅支持纵向,它适用于除 ios6 之外的所有设备 .. 在 Ios 6 设备中它显示两个方向.. 我只需要纵向.. 我正在使用导航控制器..在 appdelegate::
- (BOOL)shouldAutorotate
{
return ([[UIDevice currentDevice] orientation]==UIInterfaceOrientationPortrait);
}
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return (UIInterfaceOrientationMaskPortrait);
}
在其他 viewControllers ::
- (BOOL)shouldAutorotate {
return YES;
}
- (void)viewDidLayoutSubviews
{
DisplayFunctionName;
NSLog(@"orientation: %d",self.interfaceOrientation);
}
- (NSUInteger)supportedInterfaceOrientations
{
if (UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad)
{
return (UIInterfaceOrientationMaskAll);
}
else
{
return (UIInterfaceOrientationMaskPortrait);
}
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
DisplayFunctionName;
NSLog(@"orientation: %d",interfaceOrientation);
return (interfaceOrientation==UIInterfaceOrientationPortrait);
}