Set UINavigationBar height like in iOS 7 calendar app

I need a NavigationBar like in the calendar in iOS 7.

I have noticed that the NavigationBar does not have any blur behind it.

when going back from one detail view. It's just the "main" NavigationBar that is "normal".

Anyone have any idea how to do this?

I have tried to do this:

[self.navigationController.navigationBar setFrame:CGRectMake(0, 0, 320, 88)];

But this would move the title and the buttons down 44px.

I have another idea to add another navigation bar under the navigationController.navigationBar, but then I have a line under the first navigation bar. Anyone knows how to remove this?

Thanks!

Answers


I fixed it!

I placed a other NavigationBar under the "main" NavigationBar. Removed the "main" NavigationBars shadow line.

Remove the NavigationBar translucent and set the background color to 97% white. (it's standard). If translucent is YES it would look strange when content is behind .

[self.navigationController.navigationBar setTranslucent:NO];
[self.navigationController.navigationBar setBarTintColor:[UIColor colorWithWhite:0.97 alpha:1]];
[NavigationBarExtension setTranslucent:NO];
[NavigationBarExtension setBarTintColor:[UIColor colorWithWhite:0.97 alpha:1]];

Code to remove the line (do this in viewWillAppear: because if you push a other view controller the line must come back)

- (void)viewWillAppear:(BOOL)animated {
    for (UIView *view in self.navigationController.navigationBar.subviews) {
        if ([view isKindOfClass:NSClassFromString(@"_UINavigationBarBackground")]) {
            for (UIView *view2 in view.subviews) {
                if ([view2 isKindOfClass:[UIImageView class]] && view2.frame.size.height < 1) {
                    [view2 setHidden:YES];
                    break;
                }
            }
        }
    }
}

Code to show the line when pushing a other view controller:

- (void)viewWillAppear:(BOOL)animated {
    for (UIView *view in self.navigationController.navigationBar.subviews) {
        if ([view isKindOfClass:NSClassFromString(@"_UINavigationBarBackground")]) {
            for (UIView *view2 in view.subviews) {
                if ([view2 isKindOfClass:[UIImageView class]] && view2.frame.size.height < 1) {
                    [view2 setHidden:NO];
                    break;
                }
            }
        }
    }
}

Need Your Help

Ionic - Error: Uncaught (in promise): removeView was not found

ionic-framework ionic2 ionic-view ionic3

My Ionic app was working fine and I haven't done anything to it but suddenly I am getting this error and I don't know why.

android: how do i preserve the data in my arrayadapter/listview when change orientation?

android listview orientation listadapter

as above, is it done automatically? My list was empty once the orientation chMYanges? and nope, i need the orientation change =)