Reputation: 3301
How can we increase the space between two lines in UITextView. I have searched related topics, in which they are creating their own font. I have tried that also. It is not working.
- (void)viewDidLoad
{
[super viewDidLoad];
org_txtvw_rect = CGRectMake(self.text_view.frame.origin.x,
self.text_view.frame.origin.y,
self.text_view.frame.size.width,
self.text_view.frame.size.height);
[text_view.text sizeWithFont:[UIFont systemFontOfSize:14]
constrainedToSize:CGSizeMake(100, MAX_HEIGHT)
lineBreakMode:UILineBreakModeWordWrap];
}
Am I doing anything wrong?
Can we use this property for line spacing?
text_view.font.lineHeight
Upvotes: 2
Views: 3531
Reputation: 19307
You can't change line space in UITextView
directly. Try to use Core Text to draw the text. Use Core Text means you need to do a lot of work, take a look at https://github.com/mattt/TTTAttributedLabel
Upvotes: 1
Reputation: 4749
systemFontSize is by default Helvetica. There is no api currently available for line spacing. But you can select different fonts like Didot, Garamond for your application. If you want to use any other font which is not in iOS, then you can add that font's ttf file in resource bundle.
Upvotes: 0