2010-07-23 118 views

回答

-2

的后退按钮只需调用导航控制器上popViewControllerAnimated,它会回去。

4

使用此代码:

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 
button.frame = CGRectMake(0,0,36,30); 
[button setBackgroundImage:[UIImage imageNamed:@"backgroundImage.png"] forState:UIControlStateNormal]; 

[button addTarget:self.navigationController action:@selector(popViewControllerAnimated:) forControlEvents:UIControlEventTouchUpInside]; 
UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button]; 
[self.navigationItem setLeftBarButtonItem:barButtonItem]; 

或者使用这个库。非常容易和好看的结果。

https://github.com/boctor/idev-recipes/tree/master/CustomBackButton

相关问题