【发布时间】:2017-05-13 18:33:10
【问题描述】:
【问题讨论】:
标签: ios swift uibarbuttonitem
【问题讨论】:
标签: ios swift uibarbuttonitem
创建您的自定义导航栏 - 将 UIView 添加到视图控制器的顶部,并在其左角添加 UIButton。并在按钮下方添加标签。
【讨论】:
可以通过使用带有 UIBarButtonItem 的自定义视图来完成。像这样。
斯威夫特
let image = UIImage.init(named: "image_name")
let button = UIButton.init(type: .custom)
button.frame = CGRect.init(x: 0, y: 0, width: 100, height: 40)
button.setBackgroundImage(image, for: .normal)
button.setTitle("title", for: .normal)
let barButtonItem = UIBarButtonItem.init(customView: button)
【讨论】: