【问题标题】:UIBarButtonSystemItemRefresh on iOS 7iOS 7 上的 UIBarButtonSystemItemRefresh
【发布时间】:2013-11-06 12:06:25
【问题描述】:

我有一个可以在 iPhone 和 iPad 上运行的应用程序。我在我的一个 ViewController 中设置了一个 UIBarButton 项,但由于某种原因,它显示在 iPhone 上而不是 iPad(模拟器或真实设备)上。

我正在使用以下代码来获取 iPhone 和 iPad 的按钮图像(这是系统按钮图像)"

UIBarButtonItem *showButtonButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(loadButtonVC)];
self.navigationItem.leftBarButtonItem = showButtonButton;

我很茫然。两台设备都运行 iOS 7,并且该应用程序仅针对 iOS 7。但图像没有显示在 iPad 上,按钮在那里,因为它仍然响应按下它。

【问题讨论】:

  • 您在一个全新的通用项目中的代码在 iPhone/iPad 上都非常有效。您确定 iPad 上的控制器嵌入在导航控制器中吗?
  • 是的,它肯定嵌入在 NavigationController 中,它是 Root ViewController。我可以在情节提要中设置按钮并且它可以工作。这对我有用。还是谢谢。

标签: ios iphone objective-c ipad ios7


【解决方案1】:

使用此代码

UIBarButtonItem *refreshBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self
                                   action:@selector(loadButtonVC)];
    self.navigationController.navigationBar.topItem. leftBarButtonItem = refreshBtn;

【讨论】:

  • 我已经尝试过了,但它不起作用。我根本看不到出了什么问题。
  • 那很奇怪,因为我也遇到了同样的问题,但使用了上面的代码。你试过自定义按钮吗?不是系统刷新按钮..那可能是问题所在跨度>
  • 我使用了自定义按钮,但图像略有不同。看到我正在使用该系统,我无法让它完美,似乎无法找到直接获取资产的链接。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-01-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-06-06
相关资源
最近更新 更多