2012-04-06 29 views

回答

3

的的NSTextField是一个NSView的子类,其中有一个影子场,如果你创建一个阴影对象并将其分配给这一领域,显示将自动绘制

NSShadow* shadow = [[NSShadow alloc] init]; 
    shadow.shadowBlurRadius = 2; //set how many pixels the shadow has 
    shadow.shadowOffset = NSMakeSize(2, -2); //the distance from the text the shadow is dropped 
    shadow.shadowColor = [NSColor blackColor]; 
    self.textfield.shadow = shadow; 

在这工作,因为表现出阴影在drawRect上绘制所有视图时使用[shadow set]使用此阴影属性。

平局操作过程中做[影子集]让无论是绘制后,为下

+0

嗨安德鲁,我在这里添加了一些解释,如果你有进一步的问题,请让我知道 – Megarushing 2013-03-14 20:29:40

+0

谢谢;这似乎提高了很多答案! – 2013-03-14 20:30:52