-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 8/17/11 3:11 PM, Michael Crawford wrote:
> For those who are interested, here is a simple answer to my
> original question.
> 
> @implementation NSTextView (csstest)
> 
> -
> (NSDraggingSession*)beginDraggingSessionWithItems:(NSArray*)items 
> event:(NSEvent*)event source:(id<NSDraggingSource>)source { return
> nil; }
> 
> That's it.

Please don't do that.

It is usually bad practice to override(*) a method in a category.  It
is highly fragile, particularly because you don't know (and shouldn't
care) how the frameworks are implemented internally.

Furthermore, wherever the category gets picked up, you are overriding
that method.  So when you have some other NSTextView (or subclass
thereof) that you DO want to support dragging, it will (inexplicably)
not work.

Finally, I will note that the particular method you chose is 10.7+
only, so this presumably won't work at all on Snow Leopard and
earlier.  I recall that you said this is for an internal project, so
maybe that's OK, but personally I wouldn't jump on a Lion-only
approach this early on for something which has very good and more
broadly compatible alternate solutions.

I would STRONGLY encourage you to reconsider your approach and perhaps
try what I previously suggested vis-a-vis the responder chain.  Though
I obviously can't see what you are doing in its entirety, I get the
impression that you are painting yourself into an uncomfortably small
corner by - wait for it - "fighting the framework."

*: To be very clear here, I am talking about OVERRIDING a method, not
the intended use of categories which is to ADD a method.


- -- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFOTED0aOlrz5+0JdURAo0TAJsE3geERkN0qttbpy5gEai/Q+xgMgCdEEv3
Zss2o6N/tquQp9jNJmVhpsg=
=cteS
-----END PGP SIGNATURE-----
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to