I am trying to build a simple menubar popover app (and have done so) but I cannot get any icon to properly display in menubar. I have attached a photo for what is happening but essentially, a white square appears that is clickable/functioning but is not the icon i want to see. I have tried various setting combinations as well as black (w/ no background), white (w/ no background), and black (w/ white background) in terms of the images I have tried displaying without success. Also, all have been png files.
Can anyone help me figure out what type of image or settings combination I need to be able to display an icon?
According to the tutorial I used, I put a png file in, set the "devices" setting to "universal", set the "render as" option to "template image", and placed the icon in the 2x box. I have played around with different rendering options, as well as different scales (1x, 3x). In case it helps, here is the tutorial I am using: https://www.raywenderlich.com/450-menus-and-popovers-in-menu-bar-apps-for-macos.
this is the line of code in my app delegate that sets the icon to the image:
func applicationDidFinishLaunching(_ aNotification: Notification) {
if let button = statusItem.button {
button.image = NSImage(named:NSImage.Name("icon-1"))
button.action = #selector(togglePopover(_:))
}
...
}
This is my first stack overflow question so apologies in advance if there is anything that is unclear or if there is information that would be helpful that I didn't provide.