根据方向以编程方式更改拆分视图

时间:2015-01-06 14:38:21

标签: ios objective-c uisplitviewcontroller

我意识到苹果文档建议将拆分视图设置为根视图控制器。所以基本上我有一个带标签栏的应用程序。在标签栏的第一个索引内部,我有一个拆分视图。当设备的方向是纵向时,我希望(分割的主要细节)填满整个屏幕或成为详细页面,但更重要的是,当设备进入时,无法选择具有主要细节肖像。所以我的想法是我根据设备方向换出标签栏索引。这是我的代码的样子:

-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
        if( UIInterfaceOrientationIsLandscape(toInterfaceOrientation) )
    {

       UISplitViewController * splitview = [[UISplitViewController alloc]init];
//        
//        splitview.delegate =self;
//        [splitview willRotateToInterfaceOrientation:self.interfaceOrientation duration:0];






        NSLog(@"LandScape!!");

        NSMutableArray * array = [MyCustomwViewManager changeHomeOrientationTolandScape:[NSMutableArray arrayWithArray:self.tabBarController.viewControllers] viewController:self navigationController:self.navigationController splitView:splitview];

     [self.tabBarController setViewControllers:array animated:YES];

        // [self viewDidLoad];

    } else {

        NSMutableArray * changeSplit = [NSMutableArray arrayWithArray: self.splitViewController.viewControllers];


        NSMutableArray * array = [MyCustomViewManager changeHomeOrientationToPortrait:[NSMutableArray arrayWithArray:self.tabBarController.viewControllers] viewController:[changeSplit objectAtIndex:0] navigation:[changeSplit objectAtIndex:0]];


           [self.tabBarController setViewControllers:array animated:YES];


    }



}

我的目标是实现与yelp iPad应用程序类似的功能。希望我很清楚并且有意义。

0 个答案:

没有答案
相关问题