2012-04-06 48 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