I've been working on setting up a UI in Xcode that works similar to the iOS mail app, but the second popover view controller won't play along. I'm trying to set the title of the "Transactions" Navigation Bar to the name of the Account, but it instead sets the title for the DetailViewController:
Before I choose an account: https://i.stack.imgur.com/zo75V.png
And After I choose the "New Account": https://i.stack.imgur.com/8DPBB.png
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
Account *account = [[self fetchedResultsController] objectAtIndexPath:indexPath];
self.transactionViewController.navigationItem.title = account.name;
}
I use the above code to set the title, but the title is set for the wrong viewController... This same code produces no result at all for the iPhone version.
EDIT: I actually found the answer to this in this guide: Passing Data between View Controllers
The key is to use the -prepareForSegue:sender:
method to get the right viewController and set its title. This also allows you to pass any data from one ViewController to another whenever you use a segue to switch between them, which I now use to set the account for transactions and get the account name to set to the seque.destinationViewController.navigationItem.title
property
Thank you everyone for your help