Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically click the leftbarbutton (back-button) of a pushViewController of the navigationController

I want to click the back button in the navigationBar programmatically in my second view. It's call it this way:

Archiv *archiv = [[Archiv alloc] initWithNibName:@"Archiv" bundle:nil];
    archiv.title =  [NSString stringWithFormat:@"Archiv %@", [sender titleForState:UIControlStateNormal]];
    [self.navigationController pushViewController:archiv animated:YES];

And now i'm in the Archiv.m and after a specific event i want to get back to the first controller (without clicking the back button) - instead i want to perform the click programmatically.

Is it possible for this case?

Helpful would be to know which method is called if i click on this button, so don't even have to perform the click.

like image 717
Sharky Avatar asked Dec 04 '22 19:12

Sharky


1 Answers

yes you can

this will take you to your first view controller

 [self.navigationController popToRootViewControllerAnimated:YES];
like image 124
chewy Avatar answered May 31 '23 23:05

chewy