• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Second try: Setting text in NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Second try: Setting text in NSTextView


  • Subject: Re: Second try: Setting text in NSTextView
  • From: Alex Rice <email@hidden>
  • Date: Wed, 8 Jan 2003 21:00:03 -0700

On Wednesday, January 8, 2003, at 03:02 PM, Michael Fenske wrote:

Hmm, nobody can explain this:

Ok, I set text in a NSTextView this way:

[textView setString:@"new text"];

No problem. But can someone explain me, why this

[[textView textStorage] setText:@"new text"];

works, too? I get a waring if I compile that (as I expected)
but it really works. So, I'm curious to know why.

Just magic?

I don't see setText: in the API for NSTextStorage or any of it's superclasses, although I could be overlooking it. Is that why you are puzzled?

This is a total guess: if you could to look in the implementation source code of NSTextStorage you might see a private interface like this:

@interface NSTextStorage (privateOrDeprecatedInterface)
-(void) setText: (NSString *) s;
@end

So NSTextStorage objects would respond to that message even though it's not in the headers the API anywhere.

I don't know much about the Obj-C runtime, but I am sure there are ways to use the debugger or the Obj-C runtime itself to find out exactly where that setText: is implemented.

But you should stick with public interfaces like the ones offered by NSTextView. NSTextStorage is a "semiconcrete subclass of NSMutableAttributedString". That makes it sound like it's not for general use.

Alex Rice <email@hidden> | Mindlube Software | http://mindlube.com

what a waste of thumbs that are opposable
to make machines that are disposable Ani DiFranco
_______________________________________________
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.

  • Follow-Ups:
    • Re: Second try: Setting text in NSTextView
      • From: Michael Fenske <email@hidden>
References: 
 >Second try: Setting text in NSTextView (From: Michael Fenske <email@hidden>)

  • Prev by Date: Re: WebCore
  • Next by Date: Re: building WebCore
  • Previous by thread: Second try: Setting text in NSTextView
  • Next by thread: Re: Second try: Setting text in NSTextView
  • Index(es):
    • Date
    • Thread