开发者

NSScrollview may not respond to '-text'

I am having trouble assigning a NSString to the text of a NSScrollView. I have tried the following:

开发者_StackOverflow中文版    NSString *medium = codeView.text;

That didn't work so then I tried:

    NSString *medium = [codeView text];

This still doesn't work and it gives me the warning:

NSScrollview may not respond to '-text'

Or in the case of the "." operator it gives me the error:

Request for member 'text' is something not a structure or union.

Does anyone have any advice on how to get around this?

I am initializing the code the following way:

@interface NetCodeViewController : NSObject {
    IBOutlet NSTextView *codeView;
}
@property(nonatomic, retain) id *codeView;
@end


This:

NSString *medium = codeView.text;

And this:

NSString *medium = [codeView text];

Are actually identical in terms of the generated code (when it works). The difference being that the dot version does additional validation (and then GCC produces an imponderable struct error message anyway).

The real problem is that codeView is declared to be an NSScrollView. You probably want it to be an NSTextView and want to connect it to the NSTextView contained within the scroll view.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜