[英]Adding UIBarButtonSystemItem icons to Nav-Toolbar (SWIFT)
I have been trying to find a way to add the UIBarButtonSystemItem icon to the toolbar. 我一直在尝试找到一种将UIBarButtonSystemItem图标添加到工具栏的方法。 I have implemented it on my NavBar with the following code:
我已经使用以下代码在NavBar上实现了它:
self.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Action, target: self, action: "shareMeme")
But when it comes to the toolbar, I am at a loss. 但是当涉及到工具栏时,我很茫然。 Any ideas?
有任何想法吗?
Try: 尝试:
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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.