Re: Getting an NSString out of an NSTextView;
Re: Getting an NSString out of an NSTextView;
- Subject: Re: Getting an NSString out of an NSTextView;
- From: Ryan Bates <email@hidden>
- Date: Tue, 10 Feb 2004 21:07:17 -0800
On Feb 10, 2004, at 5:06 PM, Robert Tillyard wrote:
My problem seems to be that my version of Cocoa Browser doesn't show a
method string: for NSTextStorage and I missed it on the online
documentation.
The reason you do not see the "string" method in the NSTextStorage or
NSTextView documentation is due to inheritance. At the top of the
NSTextView documentation you see this:
NSTextView
Inherits from:
NSText : NSView : NSResponder : NSObject
This means that all instance variables and methods that are in these
classes will be in the NSTextView. If you take a look at NSText you
will see that it contains a "string" method. This is why you can call
[textView string]. For that same reason you can call [textStorage
string] because it inherits from NSAttributedString which contains the
"string" method. The terms "superclass" and "subclass" refer to the
parent and child classes respectively. If I were to subclass NSTextView
I would inherit all of the NSTextView features and be able to add my
own. I suggest picking up a good book on object-oriented programming
(OOP) with Objective-C - it is vital to have a good understanding of it
when programming in Cocoa. I suggest "Programming in Objective-C" by
Stephen G. Kochan. Here's the amazon link:
<
http://www.amazon.com/exec/obidos/tg/detail/-/0672325861/>
Ryan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.