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 6229923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:39:20+00:00 2026-05-24T09:39:20+00:00

i am using a uiview parent view….overidded touch began and touch ended methods… when

  • 0

i am using a uiview parent view….overidded touch began and touch ended methods…
when i added a UIButton as a subview in the view and touch on the button touchdown event is detected and associated method is called …but touchbegan method that was over ridden is not called…

what i want is when i touch the button the method associated with the touchdown event and touchBegan method of uiview both be called simultaneously…UIbutton is not passing the touch to its superview i.e. uiview…..?
Any idea how to do that ?
Thanks

  • 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-05-24T09:39:20+00:00Added an answer on May 24, 2026 at 9:39 am

    I’m not sure exactly how to call two touchesBegan events simultaneously on two different views, but you probably want to override the hitTest:withEvent: method of UIView. This will allow you to catch a touch event on the view underneath the UIButton before it gets to the button (hitTests work from the window upwards to the foremost view).

    - (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event
    {
        if (passToSubviews)
        {
            return [super hitTest: point withEvent: event];
        }
    
        // otherwise stop the subview receiving touches
        if ([super hitTest: point withEvent: event])
        {
            return self;
        }
    
        return nil;     
    }
    

    Maybe this can help…

    EDIT:

    Just a guess but you could try:

    - (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event
    {
        UIView* hitSubview = [super hitTest: point withEvent: event];
        if (hitSubview)
        {
             [self doTouchedInStuff];
             return hitSubview;
        }
    
        return self;         
    }
    
    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    {
        [self doTouchedInStuff];
    
        [super touchesBegan:touches withEvent:event];
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to display a small refresh button using UIButton in a standard UIView
While using UIVIEW I put an image to the background and added a UIBUtton,
I'm animating a UIView's frame property using a CAKeyframeAnimation on the view's CALayer and
I'm using UIView's + animateWithDuration:delay:options:animations:completion: method to move my view along a line over
I'm noticing that UIView animations using the UIView class methods seem to more or
I Show a view using presentModalViewController . and from this UIView I want to
I'm confused as to whether or not using UIView addTarget:action: causes that view to
I'm using UIView class method animateWithDuration for repeating my view animation. How can I
I am using a UIView animation to resize and translate a view containing multiple
I have a UIButton within a UIView. The button is docked on the bottom

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.