• 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: Overriding text size in NSTextStorage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Overriding text size in NSTextStorage


  • Subject: Re: Overriding text size in NSTextStorage
  • From: Gideon King <email@hidden>
  • Date: Tue, 11 May 2010 02:19:21 +1000

From a practical point of view, I haven't found a delegate method that allows you to alter the proposed attributes. The closest one is one that acts on proposed typing attributes, and I assume that could change with moving the insertion point, as well as when changing attributes, and would presumably be too late in the piece anyway.

From a conceptual point of view, my understanding of MVC means that a user initiated action should be reflected in the model (text storage), which should push it through to the view, which should mean that doing the changes in the text storage "should" be OK...and it works for everything except this case. The behavior I'm observing seems to clearly be a case of the view being out of sync with the text storage, until you type something, and then it syncs up again.

But anyway, I'm not here to argue what should or should not be the case - the fact is that there is an issue, and at this stage, I'm just looking for a solution...

Gideon

>
> That sounds like a dangerous thing to do — you’re violating the expected behavior of the class (i.e. what goes in is the same as what comes out.)
>
> If you want to alter the characteristics of the text, you should do so before it goes into the text view, or in one of the explicit NSTextView delegate hooks. I’m pretty sure at least one delegate call allows you to alter the text (including its style) that’s about to be inserted.
>
> —Jens

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Overriding text size in NSTextStorage
      • From: Kyle Sluder <email@hidden>
    • Re: Overriding text size in NSTextStorage
      • From: Jens Alfke <email@hidden>
References: 
 >Overriding text size in NSTextStorage (From: Gideon King <email@hidden>)
 >Re: Overriding text size in NSTextStorage (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: prevent drag from QTMovieView
  • Next by Date: Re: KeyPathsForValuesAffectingValueForKey confusion
  • Previous by thread: Re: Overriding text size in NSTextStorage
  • Next by thread: Re: Overriding text size in NSTextStorage
  • Index(es):
    • Date
    • Thread