Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Navigation bar back button method

I want to navigate to the particular page in my application and i also dont want to create any custom back button for that.If I can override the method of the navigation bar back button so I can call the poptorootviewcontroller.so i can go to specific page. Anyone knows what is the method that is called by the navigation bar button and if we can use it?

like image 900
KDeogharkar Avatar asked Feb 21 '23 02:02

KDeogharkar


2 Answers

You can try this.. Write your logic in this native method.

-(void) viewWillDisappear:(BOOL)animated {

    [super viewWillDisappear:YES];
    // Your Code
}
like image 155
Manann Sseth Avatar answered Feb 27 '23 11:02

Manann Sseth


You will have to provide the name and the implementation for the button method As there is no standard method ..

self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(backButtonPressed)] autorelease];

implementation ..

-(void) backButtonPressed {
 NSLog(@"Back button presses");

}
like image 38
Jhaliya - Praveen Sharma Avatar answered Feb 27 '23 09:02

Jhaliya - Praveen Sharma