I have one string:"Lorem ipsum dolor sit"
I need to change font size of "ipsum
".
Anybody know how can i change the font size of specific word in string.
I have one string:"Lorem ipsum dolor sit"
I need to change font size of "ipsum
".
Anybody know how can i change the font size of specific word in string.
you should use NSAttributedString
.
NSMutableAttributedString *myString = [[NSMutableAttributedString alloc] initWithString:@"Lorem ipsum dolor sit"];
[myString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:20.0] range:NSMakeRange(7, 5)];
Try this:
NSMutableAttributedString *string =
[[NSMutableAttributedString alloc]
initWithString: @"Lorem ipsum dolor sit"];
[string addAttribute: NSFontAttributeName
value: [UIFont fontWithName:@"Didot" size:24]
range: NSMakeRange(7,5)];
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"Lorem ipsum dolor sit"];
[str addAttribute:NSFontAttributeName
value:[UIFont systemFontOfSize:20.0]
range:NSMakeRange(7, 5)];