Firstly you posted iOS code in the OSX forum, this does matter as to assign text to a NSTextField control in an Mac project, is different to assigning text to a UITextField in an iOS project.
Secondly you listed this code in your first post.
_displayLabel.text = @"hello world"
_label.text = @"hello world"
But in your next posting you've put some code for a View Controller Implementation class that does not show the above code in it, you've not shown the interface .h file for the same View Controller .m class file.
So you have not posted all of the code, so it is hard for us to help you.
But as RazOrEdge has pointed out, you have to have IBOutlets linked for the Text Fields in your Interface Builder xib file, if you dont have these IBOutlets, you cannot assign text to the Text Field controls.
For Example
Code:
// .h file
@interface myClass : NSObject
{
IBOutlet UITextField *myTextField;
}
@property (nonatomic, readonly, strong)IBOutlet UITextField *myOtherTextField;
@end
// .m file
@implementation myClass
@synthesize myOtherTextField;
- (id)init
{
self = [super init];
if (self) {
myTextField.text = @"Hello";
myOtherTextField.text = @"World";
}
return self;
{
@end
In the above sudo code, I would have to link the two IBOutlets to the Text Fields in my Interface xib file, if I dont, then the text would not appear in the Text Fields.
Lastly I noticed your using dot notation in your code, which I have also done, but you should consider using Objective-C style coding, using square braces like this.
Code:
[myTextField setText: @"Hello"];
the reason for this is as you start to deal with more Cocoa Touch Framework classes, some
of there Methods are only accessible with this type of syntax.
Hope this is of some help, but unless you post all of the relevant code from your project, we will not be able to help you more.
Regards Mark