I'm trying to get a string displayed in my UITextView the moment the app is launched. I have a UIView and (obviously) a UITextView in my interface, and one outlet, myText, which is connected to the UITextView. It doesn't seem to be working and I can't say why....
Here is the code in question:
MainView.h
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
@interface MainView : UIView {
IBOutlet UITextView *myText;
}
@end
MainView.m
@implementation MainView
-(id) initWithCoder:(NSCoder *)coder {
if ((self = [super initWithCoder:coder]) != nil)
{
NSLog(@"initWithCoder executed");
myText.text = @"Hello, World!";
}
return self;
}
@end
The NSLog message is logged, so I assume that that myText.text is indeed set to "Hello World", but this isn't reflected in my UITextView. Where is the hang up here? If it helps, this is a simplified version of my actual app, and when I put that same myText.text = @"Hello, World!";
into a method that responds to a button press, the change is reflected in UITextView. I'm anticipating this is some simple thing I'm missing...
Any help is appreciated! Thanks!