Quote:
Originally Posted by Speed
I don't know how you can add it via interface builder but what I usually do is just make it an IBOutlet then add this on the viewDidLoad.
Code:
textView.text = [NSString stringWithFormat:@"Line 1\nLine 2\nLine 3\n"];
This would show as:
Line 1
Line 2
Line 3
Essentially, \n is a line break.
|
Thanks, I tried this and I get the app to build and launch successfully but when I click on the tab bar item to load the view it crashes and I get this error in console:
"'NSUnknownKeyException', reason: '[<UIViewController 0x5b594a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key textview.'"
Here's what I added in the .h file:
Code:
IBOutlet UITextView *textview;
@property (nonatomic, retain) UITextView *textview;
for the .m file:
Code:
@synthesize textview;
void view did load method:
Code:
textview.text=[NSString stringWithFormat:@"Hi how are you \n good how are you? \n great, thanks\n"];
Then I created a XIB file for this, added a text view object to the XIB, then linked up the text view with the IBOutlet and the view with the view in the document folder.
What am I doing wrong? Thanks for your help