UITextView : get text with wrap info

后端 未结 2 1667
花落未央
花落未央 2021-01-23 12:04

Is it possible to get the text inside a UITextView with its wrap info.

\"enter

So

2条回答
  •  北恋
    北恋 (楼主)
    2021-01-23 12:36

    See my answer here:

    https://stackoverflow.com/a/13588322/341994

    What you are asking to do is exactly what Core Text does for you. Indeed, Core Text is how UITextView knows how to wrap text. So you can ask Core Text where the line breaks are, just as UITextView does. See the example code in my answer - it's a lot simpler and more reliable than what you're trying to do.

提交回复
热议问题