views:

28

answers:

2

Hi all,

I have a concern about the separate line under navigation bar. Please take a look at below screenshot alt text

At the "Overview Settings" screen, I implement UITableViewController, and I see the separate line appear natively. But at "Overview" screen, I implement UIViewController and this line is not appear. How do I make it appear on every screen without add a customized view to fake this line?

Thanks so much!

A: 

Its because What I think is that the above one is navigation bar and below one is tabbar.

Kindly cross check it once again.

Or try changing the tint color of the navigation bar and check whehter its working or not.

hAPPY cODING...

Suriya
Dear Suriya, Both of them have navigation bar on top and tab-bar at bottom. I would like to know about this because navigation bar and content view have a same color: black, so I need something to separate them
Son Nguyen
Hey son have you tried changing the tint color of the navigation bar and have checked whether after changing the color too is it showing the seperator or after changing the tint color also its not showing the seperator. Post some code so i can check it out...
Suriya
Dear Suriya, I tried to set tint color for navigation bar, but it change color of whole bar while I just want to show the separate line only.
Son Nguyen
About the source code, they are the same between "Overview Settings" and "Overview" screen, the different is "Overview Settings" is implement UITablewViewController while "Overview" is implement UIViewController. I discovered that in my application, the screen which implement UITableViewController will contain that separate line
Son Nguyen
@changing tint color: I know changing tint color will change the whole navigation bar color but my concern over here was that does changing of tint color displays the seperator line?
Suriya
A: 

After researching, I found a best way to do this is add an UIView as a subview of UINavigationBar as following code:

        CGRect navFrame = [navBar bounds];
        UIView *separateLine = [[UIView alloc] initWithFrame:CGRectMake(0, navFrame.size.height - 2, navFrame.size.width, 1)];
        separateLine.backgroundColor = RGB(38,38,38);
        separateLine.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
        [navBar addSubview:separateLine];
        [separateLine release];
Son Nguyen