macOS/iOS API解説

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

目次

graphicsContextWithAttributes:

属性の辞書からグラフィックコンテキストを作って返します
+(NSGraphicsContext *)graphicsContextWithAttributes:(NSDictionary *)attributes:

解説

属性の辞書からグラフィックコンテキストを作って返します。
【attributes】
● NSGraphicsContextDestinationAttributeName
  NSWinodwNSWindow、NSMutableData、NSURL
● NSGraphicsContextRepresentationFormatAttributeName サポートする画像フォーマット
   NSGraphicsContextPSFormat
   NSGraphicsContextPDFFormat

返り値

( NSGraphicsContext * )

グラフィックス・コンテキスト

引数

( NSDictionary * )attributes

属性の辞書

フレームワーク

ApplicationKit

クラス

NSGraphicsContext

Class Methods

使用可能

10.0

参照

例文

#import "Controller.h"

@implementation Controller

- (IBAction)pushButton:(id)sender
{
NSDictionary *dic = 
[NSDictionary dictionaryWithObjectsAndKeys:
@"NSWindow",@"NSGraphicsContextDestinationAttributeName",
@"NSGraphicsContextPDFFormat",@"NSGraphicsContextRepresentationFormatAttributeName",
nil];

NSGraphicsContext *gCon = [NSGraphicsContext graphicsContextWithAttributes:dic];
NSLog([gCon className]);
NSLog([[gCon attributes] description]);

}


@end