EGOTextView icon indicating copy to clipboard operation
EGOTextView copied to clipboard

Handle non-zero frame origin and selection position onChange

Open relevante opened this issue 12 years ago • 0 comments

In my application the EGOTextView is offset from the left edge of the screen. This was causing alignment issues with the magnifier, which I've fixed here. I tested this in the demo application by creating the EGOTextView with a frame with origin.x and origin.y set to positive non-zero values.

Before: EGOTextView-weathermob-before

After: EGOTextView-weathermob-after

In addition, when the text field was edited, the selection information (_selectedRange) was being updated after the attributedString was set. This caused the selection position as monitored in the delegate -egoTextViewDidChange: method to always lag by one character. In -insertText: and -deleteBackward I'm not calling the two steps from -setSelectionRange separately, as the range needs to be set before -setAttributedString: calls the delegate function, but -selectionChanged needs to be called after the string is set. Maybe not the most elegant solution, but it works.

relevante avatar Dec 28 '12 11:12 relevante