NSViewController and other view issues
NSViewController and other view issues
- Subject: NSViewController and other view issues
- From: Gordon Apple <email@hidden>
- Date: Sat, 01 Dec 2007 17:02:36 -0600
I just discovered NSViewController a few days ago and noticed the
comments about it being an NSResponder and the possibility of placing it
into the responder chain. I liked that idea and wanted to expand on it.
First, let me say that the longer I have used Cocoa and Objective C, the
more comfortable and even fond of them I have become. However NSView (and
NSResponder, for that matter) is a very bloated class, and doesn't even do a
good job of partitioning its administrative tasks and content tasks. Now,
with animation, CALayers, etc. it is becoming even more bloated.
MacApp's view class was also rather bloated, but the introduction of
"behaviors" allowed event handling to be parceled out in a more modular
fashion, as I showed in several articles I wrote for MacApp Digest. By
allowing events to be passed down a behavior chain, individual independent
event handling capabilities could be easily mixed and matched as desired,
while using very generic view classes. (I even reorganized MacApp's
textView to do this.)
Unfortunately, I don't see a good way in NSView or NSResponder to
intercept the event handling chain and implement something similar to
"behaviors". It looks like, with the viewController approach, it would be
possible to chain event handlers, as subclasses of NSResponder, to operate
after the view has a crack at it. However, behaviors intercepted events
after the subviews but before the view, with the last behavior in the chain
calling back to the view's equivalents.
I've thought about trying to implement the "post view" version, but have
not yet delved into the animation issues and wonder if this might become an
obstacle to doing what I want.
_______________________________________________
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