I try to set font size class of UITextView in storyboard, but it always shows system font (default font, size and color). It shows the correct font if I don't set font size class.
Here's a screenshot:
Anybody know how to fix this?
I try to set font size class of UITextView in storyboard, but it always shows system font (default font, size and color). It shows the correct font if I don't set font size class.
Here's a screenshot:
Anybody know how to fix this?
It is matter of 'selectable' property of UITextView
.
Check the selectable property of UITextView
in Storyboard Editor to set it YES.
and later in viewWillAppear
set this property to NO
.
textview.text = @"some text";
textview.selectable = NO;
Try this code
-(void)viewWillAppear:(BOOL)animated
{
_linkTextView.editable = YES;
_linkTextView.font = [UIFont systemFontOfSize:18.0f];
_linkTextView.editable = NO;
}
Instead of system font you can use your font.
You can use .attributedText on your TextView and set an AttributedString there, so you can easily customise your TextView.
NSString *yourString = "your text";
NSMutableAttributedString *ms = [[NSMutableAttributedString alloc] initWithString:yourString];
[ms addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:40] range:NSMakeRange(0, yourString.length)];
© 2022 - 2024 — McMap. All rights reserved.