Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change divider color in iOS for UISplitView

Is it possible to change the color of the divider? If so, how?

I've researched as much as possible here and on Google, without luck. I'm surprised it isn't more common...

Thanks

like image 709
Tom Redman Avatar asked Aug 04 '11 16:08

Tom Redman


3 Answers

On iOS 7, the fix is to set the background color of your UISplitViewController to the same as the deep background color (probably black).

like image 195
jaredsinclair Avatar answered Nov 14 '22 09:11

jaredsinclair


There is a quicker and better way of doing it. Just change spliViewController's view backgroundColor property:

    splitViewController.view.backgroundColor = [UIColor greenColor];
like image 26
Victor Avatar answered Nov 14 '22 10:11

Victor


In the detailViewController of the SplitViewController, I added the following code to cover up the black line. My custom header is blue and 88px tall.

//blue line that covers the vertical black separator in the header
UIView *blueHeaderSplitViewSeparatorMask = [[UIView alloc] initWithFrame:CGRectMake(320, 0, 2, 88)];
[blueHeaderSplitViewSeparatorMask setBounds:CGRectMake(320, 0, 2, 88)];
[blueHeaderSplitViewSeparatorMask setBackgroundColor:[UIColor colorWithRed:0.0f/255.0f green:96.0f/255.0f blue:182.0f/255.0f alpha:1.0f]];
[self.view.superview addSubview:blueHeaderSplitViewSeparatorMask];
like image 3
Tom Redman Avatar answered Nov 14 '22 10:11

Tom Redman