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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:43:46+00:00 2026-05-15T05:43:46+00:00

Setup: I have two views that I need to respond to the touch event,

  • 0

Setup:
I have two views that I need to respond to the touch event, and they are layered out on top of one another.
View 1 is on top of View 2. View 2 is a UIWebView. View 1 is sublclassed to capture the touch event.

My problem is that if I try to call the UIWebView event handlers (touchesBegan: and touchesEnded:) from within the event handlers of View 1, which is the first responder, nothing happens. However if I set View 1 to userInteractionEnabled = NO, then the touch goes through that view and is processed properly by the 2nd view.

Any ideas on how I can have 2 views respond to a touch event? Unfortunately the 2nd view is a UIWebView, so I need to actually call the event handler and not a different method, etc…

Thanks in advance for any advice,
Joel

  • 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-15T05:43:47+00:00Added an answer on May 15, 2026 at 5:43 am

    Here is the solution to my problem. It’s working on all kinds of UIView ! If someone whant to improve this code on the

    catchUIEventTypeMotion default: ...
    

    I hope that this code will be helpful for you.

    PJ.
    

    CustomWindow.h

    #import <Foundation/Foundation.h>
    
    @interface CustomWindow : UIWindow {
    }
    
    - (void) sendEvent:(UIEvent *)event;
    
    @end
    

    CustomWindow.m

    #import "CustomWindow.h"
    
    @implementation CustomWindow
    
    - (void) sendEvent:(UIEvent *)event
    {       
        switch ([event type])
        {
            case UIEventTypeMotion:
                NSLog(@"UIEventTypeMotion");
                [self catchUIEventTypeMotion: event];
                break;
    
            case UIEventTypeTouches:
                NSLog(@"UIEventTypeTouches");
                [self catchUIEventTypeTouches: event];
                break;      
    
            default:
                break;
        }
        /*IMPORTANT*/[super sendEvent:(UIEvent *)event];/*IMPORTANT*/
    }
    
    - (void) catchUIEventTypeTouches: (UIEvent *)event
    {
        for (UITouch *touch in [event allTouches])
        {
            switch ([touch phase])
            {
                case UITouchPhaseBegan:
                    NSLog(@"UITouchPhaseBegan");
                    break;
    
                case UITouchPhaseMoved:
                    NSLog(@"UITouchPhaseMoved");
                    break;
    
                case UITouchPhaseEnded:
                    NSLog(@"UITouchPhaseEnded");
                    break;
    
                case UITouchPhaseStationary:
                    NSLog(@"UITouchPhaseStationary");
                    break;
    
                case UITouchPhaseCancelled:
                    NSLog(@"UITouchPhaseCancelled");
                    break;
    
                default:
                    NSLog(@"iPhone touched");
                    break;
            }
        }
    }
    
    - (void) catchUIEventTypeMotion: (UIEvent *)event
    {
        switch ([event subtype]) {
            case UIEventSubtypeMotionShake:
                NSLog(@"UIEventSubtypeMotionShake");
                break;
    
            default:
                NSLog(@"iPhone in movement");
                break;
        }
    }
    
    @end
    

    AppDelegate.h

    #import <UIKit/UIKit.h>
    #import "CustomWindow.h"
    
    @interface AppDelegate : NSObject <UIApplicationDelegate>
    {
        CustomWindow *window;
    }
    
    @property (nonatomic, retain) IBOutlet CustomWindow *window;
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to setup LookAndFeel Files in JDK 1.6. I have two files: napkinlaf-swingset2.jar
HELP! I just setup a virtual host for two sites that have a lot
I've got two systems that need to talk. The systems are setup likeso: System
I have two views in one XIB I want to switch, but I don't
I have a ScrollView which has two hidden images, one at the top and
I have two issues both related to (I believe) my SQL Server setup. I
I have two report parameters that were set up automatically when I created their
Setup I have a website that draws RSS feeds and displays them on the
I am building a simple book check out application. One of the things that
I have a Project Collection setup in my TFS2010RC deployment. I have two Projects

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.