osx - NSOutlineView scroll animation is not working -
i want remove nsoutlineview
's show/hide button.so,i override nsoutlineview
, mousedown
event.the follow code.
-(void)mousedown:(nsevent *)theevent { nslog(@"leftfolderlistoutlineview mousedown"); [super mousedown:theevent]; nspoint localpoint = [self convertpoint:theevent.locationinwindow fromview:nil]; nsinteger row = [self rowatpoint:localpoint]; id clickeditem = [self itematrow:row]; if (![clickeditem iskindofclass:[nsdictionary class]]) { return; } if ([self isitemexpanded:clickeditem]) { [[self animator] collapseitem:clickeditem]; }else{ [[self animator] expanditem:clickeditem]; } }
it should scroll animation when nsoutlineview collapse or expand.but in case it's not working.anyone tell me why , how can improve this?
to remove 'show/hide button' (outline cell) implement - (nsrect)frameofoutlinecellatrow:(nsinteger)row
method in nsoutliveview subclass , return nszerorect.
nsoutlineview collapse/expand animation not animatable via animator
.
only os 10.7 or above provide collapse/expand animation effects. planed support older os versions need provide separate implementation.
if want provide collapse/expand animation on os 10.6 or below, needed override 'drawrect' of nsoutlineview.
-- update --
sorry, think neglected main point. 10.7 expand/collapse animation automatically kick in when users clicked outline cell. if want show animation without default outline cells, there no other way manually implementing animation effects, think.
i made sample project implement expand/collapse animation effects image drawing. check source codes in here: https://github.com/roh0sun/ovanimation
Comments
Post a Comment