I am trying to load text into a textview. This seems simple enough:
box.text = @"hello";
NSLog(@"Box.text contains: %@", box.text);
The problem is that this NSLog just keeps printing null.
(I have IBOutlet UITextView *box declared.) I imagine that since box.text is null, that’s why nothing is actually showing up in the UITextView either.
Anyone know what’s going wrong?
Thanks a lot!
If you’re calling
box.textfrom your controller’sinitmethod, your IBOutlet hasn’t been loaded from the nib file yet – soboxis still pointing to nil, and the text assignment is going nowhere. You’ll need to wait untilviewDidLoador later to successfully access the properties of your IBOutlet.