1

我已将 a 加载NSAttributedstringUITextview. 该字符串包含具有不同字体大小的文本。我想使用 UISlider. 所以我试图相应地增加字体大小。我可以为 设置特定的字体大小attributedString,但我需要动态更改

NSTextStorage *textStorage = [[NSTextStorage alloc] initWithAttributedString:dataString];
NSLayoutManager *textLayout = [[NSLayoutManager alloc] init];
[textStorage addLayoutManager:textLayout];

NSTextContainer *textContainer = [[NSTextContainer alloc] initWithSize:CGSizeMake(320, 568)];
[textLayout addTextContainer:textContainer];

textview=[[UITextView alloc]initWithFrame:CGRectMake( 0, 50, 320, 568) textContainer:textContainer];
[self.view addSubview:textview];
4

0 回答 0