Hi!
I'm trying to create a custom action, that should be called when the back button in the navigationbar is pressed.
The structure of my app consists of three viewcontrollers pushed onto the stack of a navigationcontroller:
1. Root ViewController
2. FirstViewController
3. SecondViewController
Whenever the user tries to go back from SecondViewController to FirstViewcontroller, i want to show an AlertView asking if he really wants to go back (i know, that's more ms windows style, but i really need it...).
I tried to create a custom backbutton for FirstViewController in its init-method:
	
	
	
		
the backAction invoked by the button should just write a message and show an AlertView:
	
	
	
		
Unfortunately neither the AlertView nor the console output is ever shown.
Could someone please help me and tell me what I'm doing wrong?
thanks, kate
	
		
			
		
		
	
				
			I'm trying to create a custom action, that should be called when the back button in the navigationbar is pressed.
The structure of my app consists of three viewcontrollers pushed onto the stack of a navigationcontroller:
1. Root ViewController
2. FirstViewController
3. SecondViewController
Whenever the user tries to go back from SecondViewController to FirstViewcontroller, i want to show an AlertView asking if he really wants to go back (i know, that's more ms windows style, but i really need it...).
I tried to create a custom backbutton for FirstViewController in its init-method:
		PHP:
	
	UIBarButtonItem* button = [[UIBarButtonItem alloc] initWithTitle:@"myButton" style:UIBarButtonItemStyleBordered target:self action:@selector(backAction:)];
self.navigationItem.backBarButtonItem = button;the backAction invoked by the button should just write a message and show an AlertView:
		PHP:
	
	- (void)backAction:(id)sender
{
    NSLog(@"BACKBUTTON WAS PRESSED!!!");
    UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"Do you really want to go back?" delegate:self cancelButtonTitle:@"NO" otherButtonTitles:@"YES", nil];
    [alert show];
    [alert release];
}Unfortunately neither the AlertView nor the console output is ever shown.
Could someone please help me and tell me what I'm doing wrong?
thanks, kate
