In this case the code you need is not that different in structure from what you know from VB.NET.
You say you already have the code to put "Hello" into the label, so you must have a reference to the label stored in a variable of type NSTextField *
, let's say you've called this myLabel
. Lookup NSTextField
and you will see it has two methods backgroundColor
and setBackgroundColor:
- and any pair of methods following this naming pattern can be referenced as a property. So to set the background color of your label all you need is:
myLabel.backgroundColor = [NSColor redColor];
which should not look too unusual to a VB.NET person.
If you don't wish to use the property syntax you can instead write:
[myLabel setBackgroundColor:[NSColor red]];
and you will see this a lot in code as the property syntax is fairly new in Objective-C. HTH.