0
這裏有一個.swf(赦免,不良網站和SWF,這是我能捕捉到發生了什麼事的唯一途徑)繪製文本在NSSplitView分隔器上方,頂視圖偶爾會畫在它
http://screencast.com/t/rzJ3b5ihSj
看上去正在發生的事情是,我的分隔線有時會先畫出來,然後NSSplitView
中的頂部NSView
將其畫出。但似乎並不一致,因爲有時候分頻器會佔據上風。
這裏是我的-drawDividerInRect
方法,從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];
}
覆蓋我怎樣才能使它所以我在它分隔&文字繪製在上面所有的時間?