简体   繁体   中英

How to set editButtonItem title in Swift 3

I know it's easy in Swift 2.2. Like this:

editButtonItem().title = "My Title"

But in Swift 3, editButtonItem becomes a property of UIViewController . And UIBarButtonItem doesn't have title any more. So this doesn't work:

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

Please help me with this! Thanks!

  1. This may help you!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM