• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
forwarding Touch Events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

forwarding Touch Events


  • Subject: forwarding Touch Events
  • From: Gustavo Pizano <email@hidden>
  • Date: Wed, 1 Dec 2010 21:06:24 +0100

Hello all.

in my iPad app I have a superview screen size and there im placing smaller subviews, when I touch one of those I need to place on top another custom view which draw a circle around the taped subview, so the subview is exactly in the middle of the circle which is drawn in that view on top of it so give a fell of selections, + another functionality I need to do with that circle, like rotate the subview i tapped. Anyway, now ,if I tap somewhere between the edge of the circle and the beginning of the view bellow, I remove the circle's view but then I need to have the view bellow with the touch I did before in order to move it..

Now the symptoms are : I touch in the described area, the circles view disappears, but I can't move the view bellow the touch I initiated on the circle's view, I need to lift the finger and then I can move the view I touch.

I tried subclassing UIWindow and overwritting sendEvent method, checking if I have a subview under the touch to call that views touches methods and then call [super send:event ]. but for a touch began I get the touch, but again for moving I get nothing.

this is what I did there:

NSSet *touches = [event allTouches];
	NSLog(@"size of set %i",[touches count]);
	UITouch * aTouch = [touches anyObject];
	UIView * viewUnderPoint;
	CGPoint p = [aTouch locationInView:itemsView];
	if((viewUnderPoint = [itemsView hitTest:p withEvent:event])){
		NSLog(@"Found a view under %@",[[viewUnderPoint class] description]);

		NSMutableSet *began = nil;
		NSMutableSet *moved = nil;
		NSMutableSet *ended = nil;
		NSMutableSet *cancelled = nil;

		for(UITouch *touch in touches) {
           switch ([touch phase]) {
               case UITouchPhaseBegan:
                   if (!began) began = [NSMutableSet set];
                   [began addObject:touch];
                   break;
               case UITouchPhaseMoved:
                   if (!moved) moved = [NSMutableSet set];
                   [moved addObject:touch];
                   break;
               case UITouchPhaseEnded:
                   if (!ended) ended = [NSMutableSet set];
                   [ended addObject:touch];
                   break;
               case UITouchPhaseCancelled:
                   if (!cancelled) cancelled = [NSMutableSet set];
                   [cancelled addObject:touch];
                   break;
               default:
                   break;
           }
       }
       // call our methods to handle the touches
       if (began)     [viewUnderPoint touchesBegan:began withEvent:event];
       if (moved)     [viewUnderPoint touchesMoved:moved withEvent:event];
       if (ended)     [viewUnderPoint touchesEnded:ended withEvent:event];
       if (cancelled) [viewUnderPoint touchesCancelled:cancelled withEvent:event];
	}

based on the docs,
so I dunno if there is a way to get a view which is under another one on top,  receive the touches I did on that top most view.

Any ideas?

Thx
Gustavo

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: forwarding Touch Events
      • From: Luke the Hiesterman <email@hidden>
  • Prev by Date: Re: Load Tab View Items Lazily for Performance - How
  • Next by Date: Re: forwarding Touch Events
  • Previous by thread: Re: Load Tab View Items Lazily for Performance - How
  • Next by thread: Re: forwarding Touch Events
  • Index(es):
    • Date
    • Thread