In my iPhone app i have to change the UINavigationBar image on Button click.
so following is the function am calling on buttoclick
-(void)btnBlueDelegate{
// Create resizable images
UIImage *gradientImage44 = [[UIImage imageNamed:@"header_Blue.png"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
UIImage *gradientImage32 = [[UIImage imageNamed:@"header_Blue.png"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
// Set the background image for *all* UINavigationBars
[[UINavigationBar appearance] setBackgroundImage:gradientImage44
forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setBackgroundImage:gradientImage32
forBarMetrics:UIBarMetricsLandscapePhone];
//[[UINavigationBar appearance]setBackgroundColor:[UIColor blueColor]];
[self.view setNeedsDisplay];
}
Now my problem is that the navigation bar changes take effect when i go to another view.but it does not change immediately after the button click for same view controller.
I know the reason that my navigation bar drawn already so it cant change on button click..so can anyone please tell me how can i change my current view's Navigation bar even after a button click..
May be i have to reload the whole view.. but don't know how can i do it.
Thanks in Advance.