drawAtPoint:withAttributes:
文字列を指定した位置に表示します
-(void)drawAtPoint:(NSPoint)aPoint withAttributes:(NSDictionary *)attributes
解説
文字列を表示します。
現在フォーカスしているビューの指定した位置に属性を付加して文字列を表示します。
返り値
( void )
なし
引数
( NSPoint )aPoint
位置
( NSDictionary * )attributes
属性の辞書
● NSFontAttributeName フォント属性(NSFont)
● NSParagraphStyleAttributeName 段落スタイル(NSParagraphStyle)
● NSForegroundColorAttributeName 描画色(NSColor, default blackColor)
● NSUnderlineStyleAttributeName 下線(int)
● NSSuperscriptAttributeName スーパースクリプト(int)
● NSBackgroundColorAttributeName 背景色(NSColor)
● NSAttachmentAttributeName アタッチメント値(NSTextAttachment)
● NSLigatureAttributeName リガチャ値(int)
● NSBaselineOffsetAttributeName ベースラインオフセット値(float)
● NSKernAttributeName カーニング値(float)
● NSLinkAttributeName リンク
● NSCharacterShapeAttributeName 文字シェイプ(int?)
以下は10.2以降
● NSGlyphInfoAttributeName グリフ情報
フレームワーク
ApplicationKit
クラス
NSString Additions
Instance Methods
使用可能
10.0
参照
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSString *aString = @"string"; NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys: [NSFont boldSystemFontOfSize:[NSFont systemFontSize]] , NSFontAttributeName ,nil]; NSString *aString = @"string"; [image lockFocus]; [aString drawAtPoint:NSMakePoint(30,30) withAttributes: attributes]; [image unlockFocus]; } @end