How to get Default Back button item Event..?
How to get Default back button Event in navigation application.. how to write a code on click of back button item (note:without viewWillDisappear and also no开发者_StackOverflowt create Left bar button item) it's possible..??
You may use the UINavigationControllerDelegate
protocol for the back view.
Use the custom navigation back button to capture the touches.
UIButton *myButton = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:[UIImage imageNamed:@"goback.png"] forState:UIControlStateNormal];
[button addTarget:self action:@selector(backButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
[button setFrame:CGRectMake(0, 0, 32, 32)];
self.navigationItem.backBarButtonItem= [[[UIBarButtonItem alloc] initWithCustomView:myButton ] autorelease];
And implement the backButtonClicked:
method in your controller.
-(void) backButtonClicked:(id) sender
{
UIBarButtonItem * myButton = (UIBarButtonItem *) sender;
}
精彩评论