I have a button that has a text label. I would like to use a image for my Asset directory instead however I am not sure how
current code block
if let button = self.statusBarItem.button {
button.action = #selector(togglePopover(_:))
button.title = "ELMC Bridge"
}
What I have tried to get image as button label
if let button = self.statusBarItem.button {
button.action = #selector(togglePopover(_:))
button.image:("logo132")
}
CodePudding user response:
Try using setimage propery:
if let button = self.statusBarItem.button {
button.action = #selector(togglePopover(_:))
let image = NSImage(named: "logo132")
button.setImage(image)
}