在 swift 中将图像添加到工具栏?
Add image to toolbar in swift?
我的问题类似于this,但我只是想知道如何在swift中做到这一点。我想将 UIImageView 添加到工具栏。
let toolBar = UIToolbar()
let button = UIBarButtonItem(image: UIImage(named: "imageName"), style: .plain, target: self, action: #selector(buttonAction(_:)))
toolBar.items = [button]
我的问题类似于this,但我只是想知道如何在swift中做到这一点。我想将 UIImageView 添加到工具栏。
let toolBar = UIToolbar()
let button = UIBarButtonItem(image: UIImage(named: "imageName"), style: .plain, target: self, action: #selector(buttonAction(_:)))
toolBar.items = [button]