I have a simple Edit Button on my NavigationBar once clicked turns to Done, I'm trying to change the text on both 'Edit' and 'Done' to uppercase text, is this possible? Does anybody know of a tutorial I can check out?
self.navigationItem.rightBarButtonItem = self.editButtonItem;
Thanks.
create btnEdit object of UIBarButtonItem
in .h file like bellow:
UIBarButtonItem *btnEdit;
and then in .m
file write this code:
- (void)viewWillAppear:(BOOL)animated{
btnEdit = [[UIBarButtonItem alloc]init];
btnEdit.target = self;
btnEdit.action = @selector(btnEdit_Click:);
btnEdit.title = @"EDIT";
self.navigationController.topViewController.navigationItem.rightBarButtonItem = btnEdit;
btnEdit.enabled=TRUE;
}
- (IBAction)btnEdit_Click:(id)sender
{
if ([btnEdit.title isEqualToString:@"EDIT"])
{
[btnEdit setTitle:@"DONE"];
}
else
{
[btnEdit setTitle:@"EDIT"];
}
}