Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITextView with large font size and magnifying glass

I have a UITextView wrapped inside a UIView which can be resized (increasing frame and font size), and the magnifying glass works fine with smaller textview sizes

Magnifying glass working normal

But if I increase the textview size a lot, the magnifying glass starts going out of its frame

enter image description here

Can I just remove the magnifying glass without affecting cursor selection, or decrease the scale value inside the glass so the content fits its frame?

like image 876
Efesus Avatar asked Aug 24 '13 11:08

Efesus


1 Answers

Ok, managed to disable magnifying glass without removing the ability to move curser.

To do that, I removed the UILongPressGestureRecognizer to get rid of magnifying glass. Then used my UIPanGestureRecognizer to track the touch location of the user

CGPoint currentPos = [panRecognizer locationInView:self];

and then set the cursor location

UITextPosition *cursorPosition=[self closestPositionToPoint:CGPointMake(currentPos.x, currentPos.y)];
[self setSelectedTextRange:[self textRangeFromPosition:cursorPosition toPosition:cursorPosition]]; 
like image 88
Efesus Avatar answered Nov 19 '22 08:11

Efesus