0

I wanted to know if there's a way to change the Back link in my app.

My app is built like this : The first view (Oil) is a tableView inside a Navigation Controller. There's 3 button at the bottom, Oil, Property, Application. So if I tap on the first one (Oil) it does'nt change anything as we are already on this view. If I tap on the second button which is Property the view goes on an other Navigation Controller and an other tableView is displayed.

Orange Link

But Now if I tap on a cell in my tableview Property it brings me back to the Oil view. I perform a Segue, and with this segue I set my Navigation Bar Title as the Property name.

PropertyViewController.m :

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqualToString:@"PropDetail"]) {
        OilViewController *test = segue.destinationViewController;
        test.propName = propertyName;
    }
}

OilViewController.m :

if (_propName) {
    self.title = _propName;
    /* Imaginary Code 
        back.link = PropertyView;
    */
}
else {
    self.title = @"
}

This works If I go to Property View and then tap on a property I "go back" to the Oil View and the title is for example Dream. But the problem is that when I click on the Back buttonit brings me back to the Real Oil View. Instead of this I want the back button to go back to the PropertyView.

Can I change that in the code and how ? Thanks. I know I could just duplicate my code, or built my app in an other way, but I'm almost done and I don't want to start from scratch again.

I hope I was clear, Thanks !

Nicolas Charvoz
  • 1,509
  • 15
  • 41

1 Answers1

0

You can use unwind segue to back to any view controller you want. Check out this question What are Unwind segues for and how do you use them?

Community
  • 1
  • 1
r0dney
  • 735
  • 2
  • 5
  • 16