greenComponent
カラーの緑値を返します
解説
カラーの緑値を返します。
カラーが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"];//outlet nameに文字をセット [name setTextColor:theColor];//outlet name(text field)の文字色をtheColorにする [r setFloatValue:[theColor redComponent]];//outlet r(text field)にtheColorのred値をセット [g setFloatValue:[theColor greenComponent]];//outlet g(text field)にtheColorのgreen値をセット [b setFloatValue:[theColor blueComponent]];//outlet b(text field)にtheColorのblue値をセット [alpha setFloatValue:[theColor alphaComponent]];//outlet b(text field)にtheColorのalpha値をセット } @end