Is this piece of code suppose to set the title on the ViewController I am connecting to?
The 2 UIViewControllers are connected via a push segue – the first one is embedded in a NavigationController.
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"settingsSegue"])
{
self.navigationItem.title = [[NSString alloc] initWithFormat:@"Custom Title"];
}
}
It does not work for me, but the syntax is right.
Advance Thanks:-)
Set the title in the
viewDidLoadof the destination viewcontroller using a property in the destination VC:Then in the
viewDidLoadevent in MyDestinationViewController.h:In MyDestinationViewController.m:
And finally in
viewDidLoad: