UISplitView with UITabbar

后端 未结 4 723
无人及你
无人及你 2020-12-05 19:35

I have a strange one that I can not seem to fix. I am currently working on updating my app to iOS7. This all worked in iOS6. It is an universal app and thus uses same xib fi

相关标签:
4条回答
  • 2020-12-05 20:14

    I believe I have found an alternative solution for you. I have had the exact same problem, mostly because we are both doing something against Apple's Guidelines which is having a SplitViewController nested within a Tabbar controller (SplitView should be the root view). This was okay in iOS 5/6, but now in iOS 7 there are far too many side effects to achieve this.

    The reason you see your view stretch completely when you set the bar to be translucent is because the bar is NOT taken into account when drawing the view. When you set translucent to false, it is then taken into account of the view and you will see that grey bar there because that's your view pretending there's a tabbar at the bottom of the screen.

    And as always, a SplitViewcontroller's height cannot be changed, as it is determined by the visible window height.

    I tried everything you did and then some. The real solution came from using a third-party Split View Controller.

    I recommend switching over to https://github.com/mattgemmell/MGSplitViewController . This split view controller is actually one large View with container views living inside of it. Because of this, you avoid all the side effects of putting an actual split view controller within a tab bar.

    If that doesn't float your boat, you could create your own solution which follows the same idea of having one UIViewController with two container views contained in it, though the people behind MGSplitViewController did a good job of that already.

    This was the only way I was able to solve this issue, let me know if you find an alternative.

    0 讨论(0)
  • 2020-12-05 20:20

    I subclassed UISplitViewController and added the line below to viewDidLoad and that fixed the grey line.

    self.extendedLayoutIncludesOpaqueBars = YES;
    
    0 讨论(0)
  • 2020-12-05 20:27

    Instead of creating a subclass for UISplitViewController, I just added this code on my master's viewDidLoad:

    self.splitViewController?.extendedLayoutIncludesOpaqueBars = true
    
    0 讨论(0)
  • 2020-12-05 20:29

    For the controller that is the detail view of UISplitViewController you just do this:

    -(UITabBarController*)tabBarController{
        return nil;
    }
    
    0 讨论(0)
提交回复
热议问题