14

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 files. However the iPad uses UISplitViews on some. Like I said, this all worked in iOS6 oh this all works on the iPhone too.

The problem is a grey bar at the bottom. I changed the tab bar to be opaque to move views up properly as i had some UI clipped to bottom of views and that went underneath the tab bar, sidetracked there. But if i set it back to translucent bar, it goes underneath but stretched properly. if i dont, it adds a bar. Other tabs work fine when NOT using splitview.

The UISplitviewController is added programmatically.

See attached image for better description.

The grey bar is between my splitview and tabbar

This I have tried:

  • Added autoresize on splitview
  • Checked xib for subviews in the splitviews to have auto resize
  • Tried to force splitview to be screen bounds
  • Removed clips to bounds on all views
  • Removed autoresize subviews

Any ideas would be welcomed.

Thank you all.

UPDATE:

setting the background colour the uisplitview, it does colour the bar black. So the uisplitview is definitely stretching to it.

Jano
  • 62,815
  • 21
  • 164
  • 192
mashdup
  • 875
  • 7
  • 18
  • Hello MashDup, I am trying to implement Splitview Controllers with in tabs. Can you guide me how it can be made. – Awais Tariq Jan 24 '14 at 05:24

4 Answers4

31

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

self.extendedLayoutIncludesOpaqueBars = YES;
mick80234
  • 897
  • 8
  • 9
  • 1
    amazing, thank you. I read this and stumbled upon this page that helped more. good reference for anyone who has troubles with views. http://www.brianjcoleman.com/ios7-weve-got-a-problem/ – mashdup Oct 08 '13 at 08:29
  • 3
    You can set this property also directly in your .xib file w/out subclassing ... there are 3 extend properties you can configure. – konran Dec 22 '13 at 01:28
  • 1
    +1 for putting me on the right track; for reasons unknown in my case I needed to check one of the other extend properties to get rid of the grey bar. – mvds Jul 02 '14 at 08:20
  • Thanks, You save my time :) also thank u @mashdup for above link. – bhavesh Oct 13 '15 at 09:22
5

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.

Stefan Ayala
  • 385
  • 3
  • 8
  • Going to accept your answer and yes I have tried MGSplitViewController. I did not go with that in the end. The solution for me to allow translucent tab bar and adjust parts of the view that needed it. Strangely, tables adjust themselves accordingly. Thank you for your reply though :D – mashdup Oct 04 '13 at 12:49
  • My solution was to remove the line where I was setting "translucent" to NO, now my custom splitViewController inside a tabBarController just works. Thanks! – quarac Nov 27 '13 at 14:03
2

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

self.splitViewController?.extendedLayoutIncludesOpaqueBars = true
Douglas Ferreira
  • 2,279
  • 2
  • 27
  • 42
0

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

-(UITabBarController*)tabBarController{
    return nil;
}
Maciej Stramski
  • 210
  • 2
  • 11