I want my UITextView
to work and look similar to a crop utility (see image example below) but I cannot find the right approach how to use view's edges to move, rotate, resize my view:
I successfully applied UIGestureRecognizer
s to my entire UITextView
to move (or pan) and rotate it, but when business comes to the edges functionality where all 4 nodes would either move, rotate or resize the view, I get stuck because nodes are hard to make fully functional. I tried 2 approaches:
1. Added all 4 nodes as UIImageView
's as subviews of UITextView
. When nodes were half outside UITextView
edges I used clipsToBound = NO;
to make them displayed right. However, nodes outside the view are not responding for touch. Then I tried solution 2...
2. Wrapped UITextView
within container UIView
and added 4 nodes for each edge and UITextView
properly positioned inside. With this I achieved good UI but gesture recognizers still did not function because they were probably nested too deeply within a view which is a subview of another view that already had gesture recognizer. This needs more investigation but I feel like this approach a bit too complicated.
Am I on the right way? Perhaps, UIGestureRecognizer
is not the right solution for this goal I am trying to achieve. If someone had experience working with anything similar please point me in the right direction. I am not looking for code rather ideas...