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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:28:10+00:00 2026-05-14T03:28:10+00:00

I am developing a simple game on iPhone and I started with a View

  • 0

I am developing a simple game on iPhone and I started with a View based application, and through the UIViewController I am loading a custom UIView that contains some more UIViews and some UIImageViews. I want to detect touch events on some of the UIImageViews, but I wasn’t able so far.

I’ve created a second project for testing purposes and figured that UIImageViews handle touch events when the hierarchy is like :

UIViewController -> UIView -> UIImageView,

but when it’s like :

UIViewController -> UIView -> UIView -> UIImageView

they are not detected.

Notes:
– userInteractionEnabled is YES in all cases
– all UIViews and UIImageViews I mention above are custom subclasses.

Can you think of any reason why, when a custom UIImageView gets deeper in the view hierarchy can’t receive touch events?

  • 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-14T03:28:11+00:00Added an answer on May 14, 2026 at 3:28 am

    Touches take a long and circuitous route to their destination. Officially, they go up the responder chain, which starts at the first responder, and then goes from the deepest-touch-including view to its view controller, to the next-up touch-including view, etc.

    But the real picture is even more complicated, since, in finding the deepest-touch-including view to go to, the touch essentially “asks” the highest-level view for that info by calling the hitTest:withEvent: method. This allows some superviews to hijack touches, which can be very useful, as in UIScrollView, which sometimes does things (scrolls/zooms) before its subviews know what’s going on.

    Here are a few tips to help determine why a view might not be responding to touches:

    • Override [hitTest:withEvent:]1 on each of your views and NSLog when they get hit to see who is being considered for the responder chain.
    • Use the undocumented (and-therefore-take-it-out-before-you-submit) UIView method recursiveDescription to check the frames of all your views at runtime. Views display beyond their frame sizes by default, so they may appear ok, but have smaller sizes logically than visually — and the touches respond based on the logical (not visual) sizes.
    • This may sound dumb, but double-check that your methods are correctly connected to the output you’re looking for. For example, if you’re expecting your – [MyClass buttonPressed] method to get called when a UIButton is touched, double-check that you’ve added your MyClass instance and @selector(buttonPressed) as a target/action pair for that button.
    • If none of those work, override touchesBegan:withEvent: with NSLog messages to see where the touches are going up the responder chain.

    And, you already know this, but watch out for the userInteractionEnabled flag!

    Hopefully that’s enough to isolate the problem.

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

Sidebar

Related Questions

I'm a new iOS programming and I'm developing a simple iPhone game that needs
I developing simple game application in which i playing sound with UIView animation. theAudioPlayer
Can anyone recommend a good Java game engine for developing simple tile-based games? I'm
I am developing a multiplayer game server with Twisted. It's a simple game that
I am currently developing a simple Pong game for the iPhone. Currently using CGRectIntersectsRect
I'm developing a simple game that relies heavily on MoviePlayer and supporting both 4.0
Developing a simple game for the iPhone, what gives a better performance? Using a
I'm developing a simple 2D-game in OpenGL ES for the iPhone. My problem is
I am developing a simple game part of application where i need to create
i am developing simple game application just using pan gesture and cgaffinetransform rotate application

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.