我一直在尝试找到一种将UIBarButtonSystemItem图标添加到工具栏的方法。我已经使用以下代码在我的NavBar上实现了它:
self.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Action, target: self, action: "shareMeme")
但是当谈到工具栏时,我感到很茫然。有什么想法吗?
答案 0 :(得分:1)
尝试:
var items: Array<UIBarButtonItem> = []
items.append(UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Action, target: self, action: "selector"))
self.setToolbarItems(items as [AnyObject], animated: true)
self.navigationController?.setToolbarHidden(false, animated: true)