DAMM108
DAMM108

Reputation: 960

How to add spacing between UILabel Words

I want to increase space between the words of UILabel. From below code i was able to increase the space between characters but i want to do it for words

 NSMutableAttributedString* attrStr = [[NSMutableAttributedString alloc] initWithString:string];
[attrStr addAttribute:NSKernAttributeName value:@(4.0) range:NSMakeRange(0, attrStr.length)];

Any help or pointer will be greatly appreciated.

Thanks in advance

Upvotes: 1

Views: 764

Answers (1)

Thanh-Nhon Nguyen
Thanh-Nhon Nguyen

Reputation: 3418

Try this tricky method by replacing one space with two space:

NSString *str = [str stringByReplacingOccurrencesOfString:@" " withString:@"  "];

Upvotes: 2

Related Questions