我已将NSAttributedstring
加载到UITextview
。该字符串包含不同字体大小的文本。我想使用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];