NavigationBar Back Button add image

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    //Image Add
    UIBarButtonItem *back1=[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"back.png"] style:UIBarButtonItemStylePlain target:self action:@selector(back)];
    
    //Text Add
    UIBarButtonItem *back2 = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(back)];
    
    //left button
    self.navigationItem.leftBarButtonItem=back1;
    self.navigationItem.leftBarButtonItem=back2;
    
    //right button
    self.navigationItem.rightBarButtonItem=back1;
    self.navigationItem.rightBarButtonItem=back2;
}

-(void)back
{
    [self.navigationController popViewControllerAnimated:YES];
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s