initWithStartingColor:endingColor:
開始カラーと終了カラーでグラデーションオブジェクトを初期化して返します
-(id)initWithStartingColor:(NSColor *)startingColor: endingColor:(NSColor *)endingColor:
解説
開始カラーと終了カラーでグラデーションオブジェクトを初期化して返します。
返り値
( id )
グラデーションオブジェクト(NSGradient)
引数
( NSColor * )startingColor
開始カラー
( NSColor * )endingColor
終了カラー
フレームワーク
ApplicationKit
クラス
NSGradient
使用可能
10.5
参照
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor redColor] endingColor:[NSColor greenColor] ]; [theView lockFocus]; [gradient drawInRect: NSMakeRect(0,0,100,100) angle:(CGFloat)[theSlider floatValue]]; [theView unlockFocus]; } @end