macOS/iOS API解説

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

目次

set

フォントをセットします

解説

プリント操作やPostScript発行の間、PostScriptのshowやその他のテキスト描画オペレータのレシーバを確定します。

返り値

( void )

なし

引数

フレームワーク

ApplicationKit

クラス

NSFont

Instance Methods

使用可能

10.0

参照

+ useFont:

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{//開けるファイル拡張子の配列
NSAttributedString *aString = [[NSAttributedString alloc] initWithString:@"aaa"];
NSFont *font = [NSFont fontWithName:@"Osaka" size:36];

//フォーカスセット
[image lockFocus];

[font set];
//文字列セット
[aString drawInRect:[image bounds]];

//フォーカス解除
[image unlockFocus];

}
@end