How can I set the title for a UINavigationBar by program?

advertisements

How can I set the Title for a UINavigation Bar programmatically?


self.title = @"My View";

or

navigationBar.topItem.title = @"My View";

Depending on if you are using a UINavigationController or not.