0

I referenced the apps called "Comic Strip" and "Balloon Stickies Free"

When i add a speech balloon and touch s.b or s.b's tail, it works. But when i touch tail's around or between s.b and s.b's tail, it doesn't work. And Photo gets touch and works below the s.b.

So i tried to use hitTest:withEvent.

It works when i touch rectangle or tailRect first time. But when i touch other place in the object, and i touch rectangle or tailRect again, it doesn't work.

So how to modify this code ? i don't know .. help me please

- (id)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
    UIView *hitView = [super hitTest:point withEvent:event];

    if(CGRectContainsPoint(rectangle, currentPt)==YES || CGRectContainsPoint(tailRect, currentPt)==YES)
        return hitView;
    else
        return nil;
}
DIF
  • 2,470
  • 6
  • 35
  • 49
tulurira
  • 139
  • 1
  • 12

2 Answers2

1

Try overriding - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event instead.

Or take a look at Ole Begemann's OBShapedButton. Code can easily be modified to work with UIView instead of UIButton.

Rok Jarc
  • 18,765
  • 9
  • 69
  • 124
0

See this post horizontal scrolling. Using this code you can get all touch events in a single UIWindow class. You have to write some code to pass control appropriately.

Community
  • 1
  • 1
rakeshNS
  • 4,227
  • 4
  • 28
  • 42