FROM : Kyle Sluder
DATE : Wed Jan 16 23:47:00 2008
On 1/16/08, Luke Evans <<email_removed>> wrote:
> 2. When would be a better time to ask call the new NSView's
> scrollRectToVisible:? Presumably, there should be a 'good moment'
> known to this object itself somehow (i.e. receipt of some message to
> say that all the resizing effects up the hierarchy are completed and
> its safe to ask for scrolling operations). Clearly, if I have to call
> into the view hierarchy from 'outside' (i.e. just after the call that
> adds the new item to my model), then I'm going to have to set up some
> way to get a model item's view object, and this would seem to violate
> the nice encapsulation/separation of view an model.
If I'm not mistaken, NSScrollView (or NSClipView) registers for the
document view's NSViewFrameDidChangeNotification, which is going to
happen in the next run through the runloop after your view gets added
to the NSCollectionView. Perhaps you should have a controller of some
sort register for this notification from the collection view as well
and have that object scroll the scroll view by calling
-[NSCollectionView scrollRectToVisible:].
HTH,
--Kyle Sluder
DATE : Wed Jan 16 23:47:00 2008
On 1/16/08, Luke Evans <<email_removed>> wrote:
> 2. When would be a better time to ask call the new NSView's
> scrollRectToVisible:? Presumably, there should be a 'good moment'
> known to this object itself somehow (i.e. receipt of some message to
> say that all the resizing effects up the hierarchy are completed and
> its safe to ask for scrolling operations). Clearly, if I have to call
> into the view hierarchy from 'outside' (i.e. just after the call that
> adds the new item to my model), then I'm going to have to set up some
> way to get a model item's view object, and this would seem to violate
> the nice encapsulation/separation of view an model.
If I'm not mistaken, NSScrollView (or NSClipView) registers for the
document view's NSViewFrameDidChangeNotification, which is going to
happen in the next run through the runloop after your view gets added
to the NSCollectionView. Perhaps you should have a controller of some
sort register for this notification from the collection view as well
and have that object scroll the scroll view by calling
-[NSCollectionView scrollRectToVisible:].
HTH,
--Kyle Sluder
| Related mails | Author | Date |
|---|---|---|
| Luke Evans | Jan 16, 23:34 | |
| Kyle Sluder | Jan 16, 23:47 | |
| Luke Evans | Jan 17, 00:54 |






Cocoa mail archive

