Changing Nav Bar title programmatically Changing Nav Bar title programmatically xcode xcode

Changing Nav Bar title programmatically


self.navigationController.navigationBar.topItem.title = @"YourTitle";


or self.navigationItem.title = @"Title";


First check the index of current controller on the navigation stack through

 NSLog(@"%@", self.navigationController.viewControllers );

after finding the index of current ViewController let say 1.

UINavigationController *navCon  = (UINavigationController*) [self.navigationController.viewControllers objectAtIndex:1];    navCon.navigationItem.title = @"Hello";