UISplitviewController white line between navigation bars

I see a white separator between the navigation bars in the UISplitviewController on iOS7. I could not find a way to change this to black. I changed the backgroundColor of the splitViewController view to black, but no luck.

Screenshot: http://cl.ly/SCcu

+6
source share
6 answers

While your screen is in landscape, you can use it 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]; 
+6
source

Under the hood at the top of the screen is the UILayoutContainerView , below the main and detailed views. To change the color of the separator between the navigation bars, you need to change the background color of this view.

In Swift, in your subclass of SplitViewController, try the 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) } } } 
+5
source

Place your UISplitViewController in an optional ViewController using Container View as follows:

screenshot

Then hide the UINavigationBar in the main and detailed viewControllers , and you will only have one UINavigationBar without a white line in the additional UIViewController.

screenshot

+1
source

Try the following:

 if ( floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1 ) { splitViewController.view.backgroundColor = [UIColor blackColor]; } 
0
source

use

 splitViewController?.view.backgroundColor = UIColor.clear 

in your viewview controller (master viewcontroller), you can also set the desired color.

0
source

You can do the following to get rid of this white line:

 self.splitViewController.view.backgroundColor = [UIColor blackColor]; for (UIView *subView in self.splitViewController.view.subviews) { subView.backgroundColor = [UIColor blackColor]; } 

for a custom way to get splitViewController if you don't have direct access to it:

 UIViewController *_splitViewController = self.parentViewController; while (![_splitViewController isKindOfClass:[UISplitViewController class]]) { _splitViewController = _splitViewController.parentViewController; } _splitViewController.view.backgroundColor = [UIColor blackColor]; for (UIView *subView in ((UISplitViewController *)_splitViewController).view.subviews) { subView.backgroundColor = [UIColor blackColor]; } 
-1
source

Source: https://habr.com/ru/post/956963/


All Articles