How to change the text of UIBarButtonItem programmatically?

Try this:

UIBarButtonItem *clearButton = [[UIBarButtonItem alloc] initWithTitle:@"Clear" style:UIBarButtonItemStyleBordered target:self action:@selector(yourMethod:)];

  1. Create an IBOutlet for the UIBarButtonItem , outToMyButton in this example
  2. synthesize in .m
  3. outToMyButton.title = [NSString stringWithFormat:@"%i",myInt]; // or any NSString init

Are you creating the button in Interface Builder? Make sure that the identifier is set to Custom, otherwise you will not be able to change the title.

Select the UIBarButtonItem in Interface Builder, open the inspector (Command + Shift + I), and select "Custom" under the dropdown next to Identifier.