macOS/iOS API解説

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

目次

initWithAttributedString:

INDEX>Foundation>NSAttributedString

属性付き文字列から属性付き文字列を作って返します
-(id)initWithAttributedString:(NSAttributedString *)attributedString:

解説

属性付き文字列から属性付き文字列を作って返します。

返り値

( id )

属性付き文字列

引数

( NSAttributedString * )attributedString

属性付き文字列

クラス

NSAttributedString

Instance Methods

使用可能

10.0
iOS3.2

参照

- initWithRTF:documentAttributes:(NSAttributedString Additions)

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
NSAttributedString *aString1;
NSAttributedString *aString2;
aString1 = [[NSAttributedString alloc] initWithString:@"string"];
aString2 = [[NSAttributedString alloc] initWithAttributedString:aString1];  
 [image lockFocus];
[aString2 drawAtPoint:NSMakePoint(10,10)];
 [image unlockFocus];
}
@end