Swift--自定义leftBarButtonItem显示不出来
2019-01-17 本文已影响14人
乐逍遥的笔记
在iOS10版本上,自定义的leftBarButtonItem显示不出来,在iOS11版本上可以显示出来。原因是我在iOS10版本上没有设置自定义button的frame大小,设置一下,就可以了,iOS11上面可以不用设置。
//床位列表
let bedListBtn = RYQButton.initTextButton(title: "床位列表", action: #selector(bedListClick), target: self, font: 30, style: .system, backColor: .clear)
// bedListBtn.frame = CGRect.init(x: 39*m6Scale, y: 30*m6Scale, width: 140*m6Scale, height: 50*m6Scale)
bedListBtn.setTitleColor(ButtonBackColor, for: UIControlState.normal)
self.navigationItem.rightBarButtonItem = UIBarButtonItem.init(customView: bedListBtn)