Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding BarButtonItem To NavigationBar

I Added a NavigationBar Through IB and I Tried to Add a BarButtonItem Programatically.....But it Doesn't Work.

- (void)viewDidLoad { 

    UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:@"Edit"style:UIBarButtonItemStyleBordered target:self action:@selector(EditTable:)];
    [self.navigationItem setLeftBarButtonItem:self.addButton];
    [super viewDidLoad];
}
like image 504
Chandu Avatar asked Jan 18 '26 14:01

Chandu


1 Answers

Try to do this :

self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(backButtonTapped:)];
like image 71
Devang Avatar answered Jan 21 '26 05:01

Devang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!