Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom UINavigationController UINavigationBar

Basically I want a custom UINavigationBar. I don't want it to be "translucent" or anything, like the pictures app.

I basically want to completely remove it, but I still want to be able to add back buttons and such when navigation controllers are pushed, and I want the views (EG: UITableViewController) to be pushed down below it.

Like this:

alt text

Any ideas how to achieve this at all?

Thanks

like image 940
Thomas Clayson Avatar asked Dec 21 '22 21:12

Thomas Clayson


2 Answers

@implementation UINavigationBar (background)

- (void)drawRect:(CGRect)rect {
    UIImage *image = [UIImage imageNamed:@"navigationbar.png"];
    [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}

@end

basically, its not completely see through - its a visual lie. The only way to do it realistically is to override UINavigationBar's drawRect: method, as shown above.

like image 148
Thomas Clayson Avatar answered Jan 17 '23 09:01

Thomas Clayson


To see through the UINavigationBar, if you choose to have one, just:

self.navigationController.navigationBar.translucent=YES;

You'll have to change the tint/color to match the background if you want it to appear like the image you posted.

like image 22
Jordan Avatar answered Jan 17 '23 08:01

Jordan