Today I stuck with some interesting UITextField behaviour. So when you call:

And your current in this moment not visible, for example you don’t use scrolling in textView and text hidden by parent frame, you can get Infinite origin for cursorRect. It seems to be not so valid, as usually inline rect and values return in case of error.

Was very strange to receive in this case.

So I was used to update textView’s frame before calling caretRectForPosition:
Also if your caret is not visible you can get some strange origin – ex. {0, -800}, when your textView content height in this moment about {320, 90}.

Categories: iosUseful

Oksana Kovalchuk

Passionate IOS Developer

Related Posts

Useful

Xcode build script using

It’s not a secret, that Xcode can run BASH scripts on some events.   But, sometimes when you add your script to Xcode, you don’t think about future modification, git blame, and merge conflict. I Read more...

Snippet

Git cloning with sub-modules

For cloning  git repo with submodules, use this command: [crayon-592a1fc008c69287644916/] For already cloned repos, for clone submodules use next command in repo root: [crayon-592a1fc008c6e943635094/] And that’s all, Folks. Related

Useful

Xcode Project Structure Example

Okay, this subject is very “intimate” for every developer, but I hope, this article will help somebody in his way to perfect organization of project structure. So lets start. Related