как установить атрибуты в NSAttributedString в iOS?

Я пытаюсь установить печально известное свойство NSFontAttributeName NSAttributedString в iOS, но, похоже, это не работает:

first off, none of the NS constants seem defined for iOS I read somewhere that I could instead work around it by passing the CoreText consts instead. Fine... but still, The attribute expects an NSFont and I'm stuck with UIFont or CTFontRef, neither of which seems to work:

это не работает:

CTFontRef ctFont = CTFontCreateWithName((CFStringRef)[UIFont boldSystemFontOfSize:16].fontName, [UIFont boldSystemFontOfSize:16].pointSize, NULL);
[myAttString addAttribute:(NSString*)kCTFontNameAttribute
                          value:(id)ctFont
                          range:NSMakeRange(0, myAttString.length-1)];

это не работает:

[myAttString addAttribute:(NSString*)kCTFontNameAttribute
                          value:[UIFont boldSystemFontOfSize:16]
                          range:NSMakeRange(0, myAttString.length-1)];

Есть ли способ заставить это работать?

Ответы на вопрос(3)

Ваш ответ на вопрос