Reputation: 1926
My question is similar to this but I just wanted to know how to do it in swift. I want to add a UIImageView to a toolbar.
Upvotes: 2
Views: 1070
Reputation: 15778
let toolBar = UIToolbar()
let button = UIBarButtonItem(image: UIImage(named: "imageName"), style: .plain, target: self, action: #selector(buttonAction(_:)))
toolBar.items = [button]
Upvotes: 2