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