3

Looks like the line spacing of UITextView changed in iOS 7 (presumably because the underlaying architect of the text view changed to TextKit). My iOS project requires that the old pre-iOS 7 line spacing to be maintained.

To adjust the line spacing as needed, I found that the new NSLayoutManagerDelegate can be used.

However, I am unable to figure out the logic of evaluating the line spacing to be used (based on font metrics) to mimic the pre-iOS 7 behavior of UITextView. The logic needs to be generic as I need it to work for all fonts. Any help will be appreciated.

Unheilig
  • 16,196
  • 193
  • 68
  • 98
Jacob
  • 31
  • 2

1 Answers1

0

There is a detailed explanation on line spacing here UITableViewCell with UITextView height in iOS 7?

I use the following function (sizeThatFits) for getting the size of UITextView,

    - (CGSize)contentSizeForTextView:(UITextView *)textView
      {
      return [textView sizeThatFits:CGSizeMake(textView.frame.size.width, FLT_MAX)];
      }
Community
  • 1
  • 1