macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

colorWithKey:

カラーリストからキーで検索してカラーを返します
-(NSColor *)colorWithKey:(NSString *)key:

解説

カラーリストからキーで検索してカラーを返します。
なければnilを返します。

返り値

( NSColor * )

カラー

引数

( NSString * )key

キー

フレームワーク

ApplicationKit

クラス

NSColorList

Instance Methods

使用可能

10.0

参照

例文

#import "scriptSend.h"

@implementation scriptSend

- (IBAction)myAction:(id)sender
{
NSColorList *cList = [[NSColorList alloc] initWithName:@"NewList"];

[cList setColor:[NSColor redColor] forKey:@"red"];


NSLog([NSString stringWithFormat:@"%.1f",[[cList colorWithKey:@"red"] redComponent]]);


}

@end