ios - 将图像设置为 iOS 中的导航栏后退按钮

标签 ios iphone

<分区>


关闭 9 年前

  • 这个问题似乎是题外话,因为它缺乏足够的信息来诊断问题。更详细地描述您的问题或include a minimal example在问题本身。
  • 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,因为它们往往会吸引自以为是的答案和垃圾邮件。相反,describe the problem以及迄今为止为解决该问题所做的工作。

如何在iOS中为导航栏后退按钮设置图片

谁能告诉我必须使用的图像的确切尺寸。

谢谢

最佳答案

UIImage* image3 = [UIImage imageNamed:@"back_button.png"];
CGRect frameimg = CGRectMake(15,5, 25,25);
UIButton *someButton = [[UIButton alloc] initWithFrame:frameimg];
[someButton setBackgroundImage:image3 forState:UIControlStateNormal];
[someButton addTarget:self action:@selector(Back_btn:)
     forControlEvents:UIControlEventTouchUpInside];
[someButton setShowsTouchWhenHighlighted:YES];
UIBarButtonItem *mailbutton =[[UIBarButtonItem alloc] initWithCustomView:someButton];
self.navigationItem.leftBarButtonItem =mailbutton;
[someButton release];

关于ios - 将图像设置为 iOS 中的导航栏后退按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23931801/

上一篇:ios - 动画 barTintColor 推送 segue

下一篇:ios - 导航栏颜色不会变回来? IOS 7

相关文章:

Ios 显示/隐藏 TableView 单元格内的 View

iphone - iOS 应用内购买自动续订订阅免费试用选项不可用?

iphone - CoreGraphics 线似乎改变了大小?

iphone - 将 subview 添加到窗口后无法推送模态视图?

ios - 核心数据托管上下文未保存在多线程环境中

ios - DateFormatter 不返回 "HH:mm:ss"的日期

ios - 使 Ipad 唯一的应用程序通用而无需重新提交

ios - 如何在类别中创建 UITableViewCell 明智地排列 JSON 对象

ios - 在 iOS7 中,你如何停止第一个 View Controller 自动旋转?

ios - Swift 子类化 UIViewController 的子类