I am developing a book app where users can change the font size on the TextView.
when users change the font size, the app save the current text position not to chang
In my case, code was doing 0.0 / 0.0 resulting -nan (infinity) and used further for converting to double.
I added a guard condition to make sure values are > 0.0
Somewhere along the line here, you are getting an invalid output that is causing rect
to have the value NaN
(a special float value meaning "not a valid float number", most commonly caused by division by zero). Is it possible that you have passed an invalid or nonsensical UITextRange
to -firstRectForRange
? What happens if UITextPosition *start
references the last character in the text, when you then create another text position that is one character past the end?