支持多接口但在主屏幕中具有单一界面不适用于iOS8 iPhone
我有如下的视图结构.
HomeView(Support only portrait mode) | | V View1(Support all orientation) | | V View2(Support all orientation) 问题: 图片: 注意 : 我在下面阅读了这个问题,但它对我没有帮助. 在上面的链接亚光表示iOS8停止支持friezing方向,但我没有在苹果文档中找到它 题 : 谢谢
我解决它并发布答案,因为它可能会帮助一些人
问题: - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { // Suport only portrait mode for home screen if([self.navigationController.topViewController isKindOfClass:[ViewHome class]]) { return UIInterfaceOrientationMaskPortrait; } return UIInterfaceOrientationMaskAll; } 但是委托方法supportedInterfaceOrientationsForWindow没有被调用 Step2:覆盖方法popToRootViewControllerAnimated并编写如下代码 -(NSArray*)popToRootViewControllerAnimated:(BOOL)animated { // Only for iOS8 and above if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_7_1) { // Array which will contaimn all poped view controllers object. NSMutableArray *popedControllersArray = [[NSMutableArray alloc] init]; // Tmp created controllers object NSArray *controllers; // Hold first view cotnrollers. UIViewController *firstViewController = [self.viewControllers objectAtIndex:1]; // Pop to first view controllers with no animation. controllers = [super popToViewController:firstViewController animated:NO]; // Add poped view cotnrollers objects to the array. [popedControllersArray addObjectsFromArray:controllers]; // Pop to root view controller with animation [super popViewControllerAnimated:YES]; // Add first view controller object as it is poped by above line. [popedControllersArray addObject:firstViewController]; // return poped view controllers object. return popedControllersArray; } else { // Called super view popToRootViewControllerAnimated method and return popped // view controllers array. return [super popToRootViewControllerAnimated:animated]; } } 如有任何意见,请随意填写并提出任何问题. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |