1
は、私はこのようなリストを描きたい:ここ カスタム段落スタイルの文字列をCATextLayerに描画できますか?
1. List item 1
2. List item 2
3. List item 3
は私のコードです:私はCATextLayerの文字列プロパティにattrStringを設定しますが、paragphスタイルが適用されていないその後
NSTextList *list = [[NSTextList alloc] initWithMarkerFormat:@"{decimal}" options:0];
NSMutableParagraphStyle *paragraph = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
[paragraph setTextLists:[NSArray arrayWithObject:list]];
[list release];
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:paragraph, NSParagraphStyleAttributeName, nil];
NSString *string = @"List item 1\nList item 2\nList item 3"
NSMutableAttributedString *attrString = [[[NSMutableAttributedString alloc] initWithString:string attributes:attributes] autorelease];
[paragraph release];
結果。