iphone - 自定义导航栏后退按钮

标签 iphone objective-c uinavigationbar

我总是设置UINavigationBarsbackgroundImages,但我从来没有弄清楚如何设置后退按钮的backgroundImage UINavigationBar

我怎样才能做到这一点?

最佳答案

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

//[button setTitle:@"  Back" forState:UIControlStateNormal];
//[button.titleLabel setFont:[UIFont boldSystemFontOfSize:11]];

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

关于iphone - 自定义导航栏后退按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6312688/

相关文章:

jquery - 在 iPhone 上的 Web 应用程序中维护 PHP session

ios - IOS5自定义UINavigationBar的方法

iphone - IOS 5 : obtaining sample buffers from a file in a loop

iphone - 将资源预加载到 NSURLCache 中

iphone - 安装应用程序后,iTunes 是否会在 iPhone 上传递推荐参数?

ios - SiriKit INPayBillIntentHandling - Siri 说, "I wish I could, but <App> hasn' t 还没有和我一起设置。”

objective-c - Objective-C : Adaptive Toolbar On Orientation Change

iphone - 是否有使用App Store API的官方文档?

ios - 如何在 iOS 7 的导航栏上获得模糊和半透明的效果?

iphone - 按下 Controller 时,UIBarButtonItemStyleDone 不会在导航栏中创建蓝色按钮