iOS 10.3.3导航栏未显示所有按钮

时间:2018-03-19 06:11:02

标签: ios swift uinavigationbar

我有带3个按钮的UINavigationBar,适用于配备11个iOS的iPhone 7,但iPhone 5 10.3.3只能在其导航栏中显示三个按钮。

这里有什么问题?

    private func setupNavMenuButtons() {

    navButtonTimeframe.addTarget(self, action: #selector(timeframeMenuHandler), for: UIControlEvents.touchUpInside)
    navButtonTimeframe.setTitle(TIMEFRAMES[InAppProperties.sharedInstance.portfolioTimeframeMode], for: .normal)

    let timeframeBtn = UIBarButtonItem(customView: navButtonTimeframe)

    let refreshNav = UIBarButtonItem(barButtonSystemItem: .refresh, target: self, action: #selector(menuRefreshHandler))

    navButtonConvert.addTarget(self, action: #selector(convertMenuHandler), for: UIControlEvents.touchUpInside)

    var image : UIImage
    switch InAppProperties.sharedInstance.convertSymbolWatch {
    case PreferencesHelper.BTC_SYMBOL:
        image = (UIImage(named: "convert_btc_portfolio")?.withRenderingMode(.alwaysOriginal))!
    case PreferencesHelper.ETH_SYMBOL:
        image = (UIImage(named: "convert_eth_portfolio")?.withRenderingMode(.alwaysOriginal))!
    default:
        image = (UIImage(named: "convert_usd_portfolio")?.withRenderingMode(.alwaysOriginal))!
    }

    navButtonConvert.setImage(image, for: .normal)
    let convertNav = UIBarButtonItem(customView: navButtonConvert)

    self.navigationItem.rightBarButtonItems = [refreshNav, convertNav, timeframeBtn]
}

1 个答案:

答案 0 :(得分:0)

将该行添加到两个自定义项目(.refresh除外):

 navButtonTimeframe.frame = CGRect(x: 0.0, y: 0.0, width: 40, height: 40)

它正在发挥作用。