如何在leftBarButtonItem中添加默认左箭头?

时间:2014-03-24 15:36:24

标签: ios uinavigationcontroller back-button

我在我的应用程序中使用第三方代码(菜单)来更改导航控制器后退按钮标题。因此我使用了这样的代码:

self.navigationItem.hidesBackButton = YES;
self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Geri" style :UIBarButtonItemStyleBordered target:self action:@selector(myCustomBack)] autorelease];

此代码工作正常,但iOS 7中没有默认的左箭头图像,也是iOS 6中创建的矩形按钮。如何在后退按钮中添加默认左图像(非自定义)?

1 个答案:

答案 0 :(得分:0)

您需要自己的箭头图片。

使用自定义样式和背景图片(箭头)创建常规UIButton也设置操作,然后创建UIBarButtonItem并将此按钮设置为自定义视图;