I applied the following code to my application to change the image in the navigation bar.
- (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self.navigationController.navigationBar setTintColor:[UIColor blackColor]]; [self setNavigationBarTitle]; } -(void)setNavigationBarTitle { UIView *aViewForTitle=[[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 45)] autorelease]; UIImageView *aImg=[[UIImageView alloc] initWithFrame:CGRectMake(-8, 0, 320, 45)]; aImg.image=[UIImage imageNamed:@"MyTabBG.png"]; [aViewForTitle addSubview:aImg]; [aImg release]; UILabel *lbl=[[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 305, 45)] autorelease]; lbl.backgroundColor=[UIColor clearColor]; lbl.font=[UIFont fontWithName:@"Trebuchet MS" size:22]; lbl.shadowColor=[UIColor blackColor]; [lbl setShadowOffset:CGSizeMake(1,1)]; lbl.textAlignment=UITextAlignmentCenter; lbl.textColor=[UIColor whiteColor]; lbl.text=@ "Mobile Tennis Coach Overview"; [aViewForTitle addSubview:lbl]; [self.navigationItem.titleView addSubview:aViewForTitle]; }
See the following images. You can see the problem I am facing.


Each view controller in my application has the above methods for adjusting the background of the navigation bar.
Be that as it may, when I push the new view controller into my application. The back button will appear.
I need a return button to display. But the image should be behind the back button.
Now I'm a little confused here.
Can you help me with this?
Thank you in advance for sharing your knowledge with me.
Many thanks.
iphone xcode uinavigationitem uinavigationbar
Sagar R. Kothari
source share