我有这个项目,必须具有横向才能查看图形,并且一旦轻按后退按钮,它应该返回到纵向以查看菜单Daily Graph
和Carcadian Graph
。当用户点击Daily Graph
时,它将以横向显示图形,趋势用户将手机保持在横向视图中,并且当点击back
按钮返回菜单时,纵向将平稳运行,但是当用户点击Carcadian Graph
时它以横向显示图表,显示趋势图,用户将手机保持在横向视图,点击back
按钮返回menuVC
时,它只是保持横向,应该为纵向。由于我是Objective C的新手,我该如何解决它,需要一些帮助。谢谢
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
if (self.orientation == UIInterfaceOrientationLandscapeRight)
{
UINavigationController *navController =(UINavigationController*)[self.tabBarController selectedViewController];
UIViewController *dispViewController = navController.viewControllers.lastObject;
if ([dispViewController.nibName isEqualToString:@"dailyGraph_vc"] == YES || [dispViewController.nibName isEqualToString:@"circadianGraph_vc"] == YES)
{
return 0;
}
else
{
return UIInterfaceOrientationMaskPortrait;
}
}
else
{
return 0;
}
}
[[UIDevice currentDevice] setValue:@(UIDeviceOrientationPortrait) forKey:@"orientation"];
或其他位置执行viewWillDisappear
。它支持UIView动画块