redComponent
カラーの赤値を返します
解説
カラーの赤値を返します。
カラーがRGBカラーでなければ、例外を起こします。
返り値
( CGFloat )
赤値0.0-1.0
引数
フレームワーク
ApplicationKit
クラス
NSColor
Instance Methods
使用可能
10.0
参照
- getRed:green:blue:alpha:
例文
#import "Controller.h" @implementation Controller - (IBAction)myAction:(id)sender { NSColor *theColor = [NSColor colorWithDeviceRed:1 green:0.3 blue:0.8 alpha:1];//色を作る [name setStringValue:@"r1:g0.3:b0.8:alpha1"]; [name setTextColor:theColor]; [r setFloatValue:[theColor redComponent]]; [g setFloatValue:[theColor greenComponent]]; [b setFloatValue:[theColor blueComponent]]; [alpha setFloatValue:[theColor alphaComponent]]; } @end