cocoa - How to change color of divider in NSSplitView? -
can change color of divider? apple documentations says, can override -dividercolor in subclass of nssplitview this, doesn't works me, or understanding isn't correct. i've try create color layer on divider, e.g.:
colorlayer = [calayer layer]; nsrect dividerframe = nsmakerect([[self.subviews objectatindex:0] frame].size.width, [[self.subviews objectatindex:0] frame].origin.y, [self dividerthickness], self.frame.size.height); [colorlayer setbackgroundcolor:[color coregraphicscolorwithalfa:1]]; [colorlayer setframe:nsrecttocgrect(dividerframe)]; [self.layer addsublayer:colorlayer]; not works.
i've tried subclassing - (void)dividercolor , i'm not sure why doesn't work though know it's being called (and it's in documentation).
one way change color of divider subclass - (void)drawdividerinrect:(nsrect)arect. however, reason, method isn't called , i've checked on web answers, couldn't find anything, ended calling drawrect. here code subclassed nssplitview:
-(void) drawrect { id topview = [[self subviews] objectatindex:0]; nsrect topviewframerect = [topview frame]; [self drawdividerinrect:nsmakerect(topviewframerect.origin.x, topviewframerect.size.height, topviewframerect.size.width, [self dividerthickness] )]; } -(void) drawdividerinrect:(nsrect)arect { [[nscolor redcolor] set]; nsrectfill(arect); }
Comments
Post a Comment