Objective C - TextView 行数

Objective C - TextView Number of Lines

我有问题。 我想知道如何在文本视图中获取文本的确切 WRITTEN 行数。 我要的不是可能的行数,而是那些已经被使用过并被字符填充的行数。

例如:

你可以尝试按照

[textField sizeToFit]; //Get the minimum height and width for the text
NSInteger numLines = textField.frame.size.height / textField.font.lineHieght

不过我自己没试过