I have a few basic questions developing an app to run on macOS using Xcode 11 interface builder.
- How do you change the background color of the window, toolbar color etc. It seems like this should be easy but I don't see any option in the attributes inspector about changing background color? Do you need code to modify this? If so, an example would be helpful.
- How do you set the window to remember size and position after quitting the app?
- How do you add a custom image to a toolbar item?
Thanks
You should have defined a class and set it to the view in interface builder.
In interface builder, you should see:
- a NSWindowController
- and below a NSViewController
- in the code you should have a ViewController
- in the identity inspector set the class to ViewController
- in viewDidLoad for this ViewController class, add the 2 lines for layer
class ViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.view.wantsLayer = true
self.view.layer?.backgroundColor = NSColor.blue.cgColor