开发者

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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜