-1

I have two rectangle as show below, both can rotate both can be resized.

enter image description here

enter image description here

Now my question is, whenever yellow will move towards white Rectangle which is before 5px, Green rect edge. I should be notified when yellow rect will touch the white rect lines.

After doing a lot of work I am able to do when the both rectangle is not rotated. For the same way when that view rotated I should be notified. I have draw the white rect in first image. Please consider the same image for rotated one.

halfer
  • 19,824
  • 17
  • 99
  • 186
Sanoj Kashyap
  • 5,020
  • 4
  • 49
  • 75
  • I don't think this is/was very understandable, and can be closed (at this very late stage) as "unclear what you are asking". – halfer Nov 26 '17 at 21:23

1 Answers1

-1

Just Try this I think It will work

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{   
    if (!self.clipsToBounds && !self.hidden && self.alpha > 0) {
        for (UIView *subview in self.subviews.reverseObjectEnumerator) {
            CGPoint subPoint = [subview convertPoint:point fromView:self];
            UIView *result = [subview hitTest:subPoint withEvent:event];
            if (result != nil) {
                return result;
                break;
            }
        }
    }

    // use this to pass the 'touch' onward in case no subviews trigger the touch
    return [super hitTest:point withEvent:event];
}
Satish
  • 133
  • 11