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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:34:19+00:00 2026-05-16T04:34:19+00:00

Basically, here is my view hierarchy (and I appologize if this is hard to

  • 0

Basically, here is my view hierarchy (and I appologize if this is hard to read… I’m new here so posting suggestions happily accepted)


–AppControls.xib

——-(UIView)ControlsView

—————– (UIView)TopBar

—————– ————– btn1, btn2, btn3

—————– UIView)BottomBar

—————– ————–slider1 btn1, btn2

–PageContent.xib

—————– (UIView)ContentView

—————– ————–btn1, btn2, btn3

—————– ————–(UIImageView)FullPageImage


My situation is that I want to hide and show the controls when tapping anywhere on the PageContent thats not a button and have the controls show, much like the iPhone Video Player. However, when the controls are shown I still want to be able to click the buttons on the PageContent.

I have all of this working, except for the last bit. When the controls are showing the background of the controls receives the touch events instead of the view below. And turning off user interaction on the ControlsView turns it off on all its children.

I have tried overriding HitTest on my ControlsView subclass as follows which I found in a similar post:

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
UIView *hitView = nil;
NSArray *subviews = [self subviews];
int subviewCount = [subviews count];
for (int subviewIndex = 0; !hitView && subviewIndex < subviewCount; subviewIndex++){
hitView = [[subviews objectAtIndex:subviewIndex] hitTest:point withEvent:event];
}   
return hitView;
}

However, at this point my slider doesn’t work, nor do most of the other buttons, and really, things just start getting weird.

So my question is in short: How do I let all the subviews of a view have touch events, while the super view’s background is unclickable, and the buttons on views below can receive touch events.

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-16T04:34:20+00:00Added an answer on May 16, 2026 at 4:34 am

    You’re close. Don’t override -hitTest:withEvent:. By the time that is called, the event dispatcher has already decided that your subtree of the hierarchy owns the event and won’t look elsewhere. Instead, override -pointInside:withEvent:, which is called earlier in the event processing pipeline. It’s how the system asks “hey view, does ANYONE in your hierarchy respond to an event at this point?”. If you say NO, event processing continues below you in the visible stack.

    Per the documentation, the default implementation just checks whether the point is in the bounds of the view at all.

    Your strategy is to say “yes” when any of your subviews is at that coordinate, but say “no” when the touch would be hitting the background.

    - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
    {
        for (UIView * view in [self subviews]) {
            if (view.userInteractionEnabled && [view pointInside:[self convertPoint:point toView:view] withEvent:event]) {
                return YES;
            }
        }
        return NO;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am basically having the exact same problem as here: SQL View: Join tables
Here's my view. Basically, it returns different Responses based on whether it's logged in
we have a very customized UITableViewCell here. So it basically looks like this: +----------------+
So basically here's my problem. I'm looking for a solution to allow us to
Okay basically here's where I'm at. I have a list of PropertyDescriptor objects. These
Basically, here's my problem. I'm calling someone else's FORTRAN functions from my C++ code,
Basically I'm going to go a bit broad here and ask a few questions
I'm seeing basically the same issue described here I have a table that starts
Here is my code... basically it finds any page-NUMBER- within a variable and then
Here is my predicament. Basically, I need a column in a table to hold

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.