Reputation: 4168
I've got an NSTextField
called resultsView
that I'd like to populate with the string graphical_availability
.
I've tried the following:
[resultsView setValue:graphical_availability];
but keep getting an error during runtime:
2012-08-13 08:39:08.468 App-Name[75231:6003] -[NSTextField setValue:]: unrecognized selector sent to instance 0x100509730
2012-08-13 08:39:08.470 App-Name[75231:6003] An uncaught exception was raised
2012-08-13 08:39:08.470 App-Name[75231:6003] -[NSTextField setValue:]: unrecognized selector sent to instance 0x100509730
So, obviously setValue
isn't recognized as a method on the NSTextField
class that I'm using. I'm new to Objective-C (obviously) and have had trouble finding it on Apple's docs.
How can I set the value of this textField?
Thank you!
Upvotes: 3
Views: 8675
Reputation: 1
Don't forget the underscore to call the setter:
[_resultsView setStringValue:graphical_availability];
Upvotes: 0
Reputation: 119242
setStringValue:
is the method you need.
From the NSTextField class reference:
Overview
The parent class, NSControl, provides the methods for setting the values of the text field, for example: setStringValue:, setDoubleValue:, etc.. There are corresponding methods to retrieve values.
Upvotes: 7