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

Snippet

Git cloning with sub-modules

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

Debug

Xcode debugging tool – PonyDebugger

Once upon a time Last time when QA comes to me, they want visual debugging tool for our iOS apps. I already researched this subject, and already use CocoaLumberjack tool (with XCodeColors plugin of course), but Read more...

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