【问题标题】:How to set editButtonItem title in Swift 3如何在 Swift 3 中设置 editButtonItem 标题
【发布时间】:2016-09-19 03:34:57
【问题描述】:

我知道在 Swift 2.2 中这很容易。像这样:

editButtonItem().title = "My Title"

但在 Swift 3 中,editButtonItem 成为 UIViewController 的属性。 UIBarButtonItem 不再有标题。所以这不起作用:

editButtonItem.title = "My Title" // doesn't work

请帮帮我!谢谢!

【问题讨论】:

    标签: ios iphone swift swift3


    【解决方案1】:
    1. 这可能对你有帮助!

      let navigationBar = navigationController!.navigationBar
      navigationBar.tintColor = UIColor.blueColor()
      
      let leftButton =  UIBarButtonItem(title: "Left Button", style: UIBarButtonItemStyle.Plain, target: self, action: nil)
      navigationItem.leftBarButtonItem = leftButton
      

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-20
      • 2017-01-30
      • 2017-04-09
      • 2017-02-07
      • 2016-11-10
      相关资源
      最近更新 更多