objective c - Drawing text above the divider in an NSSplitView, the top view will occasionally draw over it -
here's .swf (pardon, bad website , swf, way capture happening)
http://screencast.com/t/rzj3b5ihsj
what appears happening, divider drawn first, , top nsview
in nssplitview
draws on it. seems inconsistent, because divider draws on top.
here -drawdividerinrect
method, overridden nssplitview
-(void) drawdividerinrect:(nsrect)arect { [[nscolor colorwithred:10.0/255.0 green:10.0/255.0 blue:10.0/255.0 alpha:0.0] set]; nsrectfill(arect); id topview = [[self subviews] objectatindex:0]; nsrect topviewframerect = [topview frame]; nsdictionary *attributes = [nsdictionary dictionarywithobjectsandkeys:[nsfont fontwithname:@"helvetica" size:26], nsfontattributename,[nscolor whitecolor], nsforegroundcolorattributename, nil]; nsattributedstring * currenttext=[[nsattributedstring alloc] initwithstring:@"tool properties" attributes: attributes]; nssize stringsize = [currenttext size]; cgfloat xoffset = ([topview frame].size.width - stringsize.width)/2; nsrect textrect = nsmakerect(topviewframerect.origin.x+xoffset, topviewframerect.size.height+50, stringsize.width, stringsize.height); [currenttext drawinrect:textrect]; }
how can make divider & text within draws on top time?
so divider, , text wanted draw, being done on nssplitview
itself. 2 views on either side of divider subviews, , there's no way draw in front of them. ended doing add padding @ bottom of top view divider text exposed
Comments
Post a Comment