I would need to add some contents inside a NSBox, an Image and some text. To do that I use the methods of NSBox class and call them on the object.
I created an IBOutlet:
@IBOutlet weak var theBox: NSBox!
and I also have a button, once I click it, the box will be filled with text (NSTextField):
@IBAction func filler(sender: AnyObject)
{
var label: NSTextField! = NSTextField() //Initialized a label to put it in the box
label.stringValue = "My text hey hey hey!"
theBox.setContentView(label) //I GET AN ERROR MESSAGE HERE
}
to add the content I used .setContentView
but this method is not callable on the object theBox
and I don't know why I am wrong. Look at the documentation. The method exists and it is callable on the NSBox objects.
I'm new with swift and OSX development. Any Idea?