Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UISplitviewController white line between navigation bars

I see a white divider between the navigation bars in a UISplitviewController on iOS7. I couldn't find a way to change that to black. I changed the backgroundColor of the splitViewController's view to black but no luck.

Screenshot: http://cl.ly/SCcu

like image 573
Chaitanya Avatar asked Oct 29 '13 16:10

Chaitanya


3 Answers

As long as your screen is in Landscape, you can use this as a workaround:

    UIView *coverView = [[UIView alloc] initWithFrame:CGRectMake(320, 0, 1, 64)];
    [coverView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"black_pixel.png"]]];
    [splitViewController.view addSubview:coverView];
like image 147
FeltMarker Avatar answered Nov 18 '22 01:11

FeltMarker


Under the hood, there is a UILayoutContainerView at the top of the screen, below the master and detail views. To change the separator color between nav bars, you only need to change the background color of that view.

In Swift, in your subclass of SplitViewController, try following:

override func viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews()

    if let potentialSeparatorView = view.subviews.first as? UIView {
        if round(potentialSeparatorView.bounds.height) == 64 {
            potentialSeparatorView.backgroundColor = UIColor(red:0.20, green:0.55, blue:0.83, alpha:1)
        }
    }
}
like image 5
Xhacker Liu Avatar answered Nov 18 '22 02:11

Xhacker Liu


Put your UISplitViewController in additional ViewController with Container View like this:

screenshot

Then hide UINavigationBars in master and detail viewControllers, and you'll have only one UINavigationBar without a white line in additional UIViewController.

screenshot

like image 1
Vladimir Vishnyagov Avatar answered Nov 18 '22 01:11

Vladimir Vishnyagov