Slaknation
Slaknation

Reputation: 1926

Add image to toolbar in swift?

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

Answers (1)

RajeshKumar R
RajeshKumar R

Reputation: 15778

let toolBar = UIToolbar()
let button = UIBarButtonItem(image: UIImage(named: "imageName"), style: .plain, target: self, action: #selector(buttonAction(_:)))
toolBar.items = [button]

Upvotes: 2

Related Questions