1

I am running iOS7 and have a UINavigation controller and a UIStatusBar that are both orange, they blend perfectly, however if I load a UIView that has a UIToolbar at the top of the view over the UINavigationController it has a black line at the top as shown in the image:

enter image description here

I would like to know how to either get rid of this or change it to white.

I have added this code to ViewDidLoad

self.view.layer.borderColor = [UIColor whiteColor].CGColor;
self.view.layer.borderWidth = 0.5f;

which adds a white line all around the view so the orange tool bar doesn't go right to the edge, so this is not a good solution.

halfer
  • 19,824
  • 17
  • 99
  • 186
HurkNburkS
  • 5,492
  • 19
  • 100
  • 183
  • I would assume this solution works for `UIToolbars` as well: http://stackoverflow.com/questions/19226965/how-to-hide-ios7-uinavigationbar-1px-bottom-line – Timothy Moose Mar 04 '14 at 01:33

1 Answers1

0

I found a work around, not sure if this is the best practice maybe I can get some comments on it but this is how I have fixed it.

myToolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.frame.size.width, 45)];
[myToolBar setTranslucent:NO];
myToolBar.clipsToBounds = YES; // stop the top black line from showing.
UIView *modalViewLine = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.myToolBar.frame.size.width, 0.8)];
modalViewLine.backgroundColor = [UIColor whiteColor];
[myToolBar addSubview:modalViewLine];

The most important things being here, using clipsToBounds prevents the black shadow or line form appearing above the UIToolBar, then I added a UIView with a white background and that is 0.8pxl high to the top of the UIToolbar.

So if you want to stack a modal view above the current NavView it will look like this

enter image description here

and the deeper you go, the more lines you add per view. give a good visual que to the user so they know where they are in the application.

enter image description here

HurkNburkS
  • 5,492
  • 19
  • 100
  • 183