Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8384173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:20:37+00:00 2026-06-09T17:20:37+00:00

I am sure that this problem will be easily resolved however I am relatively

  • 0

I am sure that this problem will be easily resolved however I am relatively new to iOS development. I am trying to handle passing touch events to children that are lower in the draw order on a UIView. For example –

I create extended UIImageView to create my MoveableImage class. This class is just basically UIImageView that implements the touchesBegan,touchesEnded and touchesMoved-

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{


[self showFrame];

//if multitouch dont move
if([[event allTouches]count] > 1)
{
    return;
}



    UITouch *touch = [[event touchesForView:self] anyObject ];

    // Animate the first touch
    CGPoint colorPoint = [touch locationInView:self];

    CGPoint touchPoint = [touch locationInView:self.superview];


    //if color is alpha of 0 , they are touching the frame and bubble to next responder
    UIColor *color = [self colorOfPoint:colorPoint];
    [color getRed:NULL green:NULL blue:NULL alpha:&touchBeganAlpha];
    NSLog(@"alpha : %f",touchBeganAlpha);

    if(touchBeganAlpha > 0)
    {
          [self animateFirstTouchAtPoint:touchPoint];
    }
    else {
        [super.nextResponder touchesBegan:touches withEvent:event];
    }



}

So the end result is basically this- If they are touching the frame of the imageView and not the image inside the other image that will be underneath can possibly respond. See this image for an example.

Passing touch to lower view

So far I have tried next responder however that does not solve the problem. Any help would be greatly appreciated!

Resolved- I stopped checking the alpha on the touchesBegan and touchesMoved. Ovveriding pointInside allowed the UIView to handle that for me.

-(BOOL) pointInside:(CGPoint)point withEvent:(UIEvent *) event
{
  BOOL superResult = [super pointInside:point withEvent:event];
  if(!superResult)
  {
   return superResult;
  }

  if(CGPointEqualToPoint(point, self.previousTouchPoint))
  {
     return self.previousTouchHitTestResponse;
  }else{
     self.previousTouchPoint = point;
  }

  BOOL response = NO;

  //if image is nil then return yes and fall back to super
  if(self.image == nil)
   {
     response = YES;
   }

  response = [self isAlphaVisibleAtPoint:point];
  self.previousTouchHitTestResponse = response;
  return response;





}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:20:38+00:00Added an answer on June 9, 2026 at 5:20 pm

    You can override instead - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event method for your subclass of UIImageView. (It is a method of uiview that each subclass can override)

    The UIView uses this method in hitTest:withEvent: to determine which subview should receive a touch event. If pointInside:withEvent: returns YES, then the subview’s hierarchy is traversed; otherwise, its branch of the view hierarchy is ignored.

    Check the source code on github of OBShapedButton. They handle tap event only for the opaque part of a button.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this annoying problem, that Im pretty sure happens to all of you
I am sure that this kind of questions must have been asked before, but
I am sure that the answer to this has been posted before. Forgive me
I see this question here on SO but I am not sure that answers
I have this function I'm using and I want to be sure that it
Not too sure how to formulate my question and I hope that this is
I am not sure where i've seen this before, but im sure that there
After reading this article on thedailywtf.com, I'm not sure that I really got the
I'm pretty sure there is an easier way to do this that I'm missing
This method that draws my tiles seems to be quite slow, Im not sure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.