Hovanky
Hovanky

Reputation: 303

How to manipulate the underlying Text View within a Window?

This is a document-based app. I want to manipulate the underlying text view within my window. I set it up as follows:

enter image description here So I also created an outlet to my document class to manipulate it.

@property (strong) IBOutlet NSTextView *textView;

Though it doesn't respond to any methods I call on it. Just to test, i want the textview to load with inserted text but the textview doesn't respond at all.

self.textView.string = @"Hello world";

What am I doing wrong?

Upvotes: 0

Views: 152

Answers (1)

matt
matt

Reputation: 534950

You cannot refer to the text view initialized from the nib until the nib has loaded and the text view has been created. At that point, windowControllerDidLoadNib: is called, and the nib objects are instantiated. Until then, the textView outlet is nil. So I'm guessing that that's the problem.

Upvotes: 1

Related Questions