2

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
Newbee
  • 3,231
  • 7
  • 42
  • 74
  • 1
    Unfortunately, creating a custom font is the only solution. Figure out what you're doing wrong there and then post it here. – Bourne Aug 17 '12 at 09:54

2 Answers2

1

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

fannheyward
  • 18,599
  • 12
  • 71
  • 109
0

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.

Ankit Thakur
  • 4,739
  • 1
  • 19
  • 35