0

iOS Navigation Bar - I would like to set the title in Navigation bar with a dynamic value.

Title could be Coffee (xxx cups)

The value of xxx is changed dynamically based on user input.

Thank you.

Tom Lee
  • 15
  • 2

1 Answers1

3

Somewhere in your view controller code:

self.navigationItem.title = [NSString stringWithFormat:@"Coffee (%d cups)", self.numberOfCupsOfCoffee];

Without more details, I can't be more precise.

Cyrille
  • 25,014
  • 12
  • 67
  • 90