I was crawling Dribble and found the attached design. I was wondering how to do a custom navigation bar like this. I mean how create the navigation bar once and reuse it implici
Using Category
, add code below in your delegate file (.m)
@implementation UINavigationBar (UINavigationBarCategory)
- (void)drawRect:(CGRect)rect
{
UIImage *navBg = [UIImage imageNamed:@"NavBar.png"];
[navBg drawInRect:CGRectMake(0, 0, 320, 44)];
}
@end
Edit:
Using Category
is not a good way, I wrote a demo without using Category
, click here.