1

I have something like a mixer, which opens the tracks volumes when I touch a button.

To avoid making the view bigger than it needs, i'm drawing the volume sliders outside the bounds. The thing is that now, I have the touch being handled by what is below those sliders and not the sliders them selfs.

How can I make a UIView child receive the touch when it is outside the parents bound, but above anything else that is drawn around?

Is this possible?

I tried the hit test method suggested in the link below without success:

interaction beyond bounds of uiview

Thanks,

With my best regards,

Nuno Santos

Community
  • 1
  • 1
Nuno Santos
  • 1,476
  • 3
  • 17
  • 34

2 Answers2

1

I have found the solution to this problem. Basically I need to override the method

-(BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event

which

"Returns a Boolean value indicating whether the receiver contains the specified point."

First I test the point with the super view. If it returns none, I'll test against the objects that are being drawn outside the parent's bounds.

-(BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
    if ([super pointInside:point withEvent:event])
    {
        return YES;
    }
    else
    {
        id elem;

        NSEnumerator * enumerator = [tracks objectEnumerator];

        while(elem = [enumerator nextObject])
        {
            LKTrack *track = (LKTrack*) elem;

            if ([track pointInside:[self convertPoint:point toView:track] withEvent:event])
            {
                return YES;
            }
        }
    }

    return NO;
}
ipraba
  • 16,485
  • 4
  • 59
  • 58
Nuno Santos
  • 1,476
  • 3
  • 17
  • 34
-1

In the answer above, what is the 'tracks' and how do you get it?

Logan
  • 52,262
  • 20
  • 99
  • 128
Charles D'Monte
  • 370
  • 4
  • 16
  • 2
    This is not an answer. You should delete this and post a comment under the answer in question. – Logan May 15 '14 at 05:16