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

  • Home
  • SEARCH
  • 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 6029045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:49:43+00:00 2026-05-23T04:49:43+00:00

I’m having trouble getting my UIButtons , UIScrollViews etc working in this situation: I

  • 0

I’m having trouble getting my UIButtons, UIScrollViews etc working in this situation:

I have the base UIViewController, which is the root controller of the UIWindow.
Above that layer I have some other UIViews added, which I will call the “Middle Layer View”. And on the top I have another UIView added for overlay objects.

The Middle Layer View is changed for different views regularly. The UIView it uses is from a UIViewController, made by a NIB file. Here’s an example

if ( mode == eModeShowView1 )
    UIViewController* nextController = [[UIViewController alloc] initWithNibName:@"View1"...
else if ( mode == eModeShowView2 )
    UIViewController* nextController = [[UIViewController alloc] initWithNibName:@"View2"...

[UIView insertSubview:nextController.view below:m_overlayView];

Now, when I touch on screen, the first responder is obviously the OverlayView or any UIResponder on the OverlayView that has been touched.
The UIEvent of the touch input goes up the view chain but seems to skip the Middle Layer View and the UIResponders on that UIView altogether. It jumps straight to the root UIViewController.

Does anyone know what’s going on here?

Could it be solved by somehow creating two UIEvents? One for the Overlay View and one for the Middle Layer View? Is that possible? If so, how?

Any help would be most appreciated.
Thanks,
Rich

  • 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-23T04:49:43+00:00Added an answer on May 23, 2026 at 4:49 am

    edit1 start:

    you can put a UITapGestureRecognizer to the m_overlayView and initWithTarget:your-middleview action:some-method-in-middleview

    Now, in your middleview you can identify recognizer.state as UIGestureRecognizerStateBegan, Ended etc and do what you want to do.

    edit1 end:

    You can debug it. Just use the logs in touchesbegan in all your controllers. It will be clear by logs the sequence of touch responses.

    Ok.. so this description of method from documentation might answer you. Your m_overlayView and nextController.view are regarding each other as siblings and not superview. So your touch on either of them will not be reported to the other but instead to the base superview which is a common superview to both the siblings.

    Hence you are getting that the middle layer is being bypassed. Actually your middle-layer is a sibling and no more a superview. Hope that at least gives you some way ahead 😉

    insertSubview:belowSubview:
    

    Inserts a view below another view in the view hierarchy.

    (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview
    

    Parameters:

    view
    

    The view to insert below another view. It’s removed from its superview if it’s not a sibling of siblingSubview.

    siblingSubview:

    The sibling view that will be above the inserted view.

    Discussion:

    This method retains view and sets its next responder to the receiver, which is its new superview.

    Views can have only one superview. If view already has a superview and that view is not the receiver, this method removes the previous superview before making the receiver its new superview.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
We're building an app, our first using Rails 3, and we're having to build
I have a bunch of posts stored in text files formatted in yaml/textile (from
I am trying to loop through a bunch of documents I have to put
I'm making a simple page using Google Maps API 3. My first. One marker

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.