Search code examples
iphonebackgrounduinavigationbaruisplitviewcontroller

change navigation bar background using my own image


i want to change navigation bar background using my own image, but i really dont know what to do. i was search it on google, but some samples tell in navigationbar template. my application is a split view base. How could i do that??


Solution

  • If you want to change the background of the navigation bar that too without using category, this might be helpful to give that feel, see if it fulfills your need:

    - (void)viewDidLoad {
        [super viewDidLoad];
    
            UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 44.0)];
            //here for v, width= navBar width and height=navBar height
    
        [v setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"a.png"]]];
    
        [self.view addSubview:v];
    
        [v release];
    
        [self.navigationController.navigationBar setBackgroundColor:[UIColor clearColor]];
    
        [self.navigationController.navigationBar setBarStyle:UIBarStyleBlackTranslucent];
    }