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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:22:39+00:00 2026-06-14T18:22:39+00:00

everyone! I need to detect 2 touches on different image views in same time.

  • 0

everyone! I need to detect 2 touches on different image views in same time. So I need to start timer when user touch both image views in same time. And stop timer when touches is end. The image views are moving on screen. There are no problems when I use one image view. Have you any ideas?

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    NSSet *allTouches = [event allTouches];
    for (UITouch *touch in allTouches)
    for (UITouch *touch2 in allTouches)

    {
        CGPoint location = [touch locationInView:touch.view];
        CGPoint location2 = [touch2 locationInView:touch2.view];

        if ([touchArea2.layer.presentationLayer hitTest:location2]) {
             touchArea2.image = [UIImage imageNamed:@"TouchAreaTouched"];
        }
        if ([touchArea.layer.presentationLayer hitTest:location]) {
           touchArea.image = [UIImage imageNamed:@"TouchAreaTouched"];

            timerTouch = 10;
            touchTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0) target:self selector:@selector(randomVoid) userInfo:nil repeats:YES];
        } else if (![touchArea.layer.presentationLayer hitTest:location]){
            [touchTimer invalidate];
            touchTimer = nil;
        } }
}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    NSSet *allTouches = [event allTouches];
    for (UITouch *touch in allTouches)
        for (UITouch *touch2 in allTouches)   {


            CGPoint location = [touch locationInView:touch.view];
            CGPoint location2 = [touch2 locationInView:touch2.view];


            if (![touchArea.layer.presentationLayer hitTest:location]){
                touchArea2.image = [UIImage imageNamed:@"TouchArea"];
                touchArea.image = [UIImage imageNamed:@"TouchArea"];
                [touchTimer invalidate];
                touchTimer = nil;
            }
        }

}


-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

    touchArea.image = [UIImage imageNamed:@"TouchArea"];
    [touchTimer invalidate];
}

Thanks for any help))

  • 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-06-14T18:22:40+00:00Added an answer on June 14, 2026 at 6:22 pm

    I thought about this problem a lot and I find the way how to do that.
    Here is my code:

    -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    
        NSSet *allTouches = [event allTouches];
        for (UITouch *touch in allTouches)
            for (UITouch *touch2 in allTouches)
    
    
    
        {
            CGPoint location = [touch locationInView:touch.view];
            CGPoint location2 = [touch2 locationInView:touch2.view];
    
    
            if ([touchArea2.layer.presentationLayer hitTest:location]) {
                touchArea2.image = [UIImage imageNamed:@"TouchAreaTouched"];
    
            }
    
            if ([touchArea.layer.presentationLayer hitTest:location]) {
               touchArea.image = [UIImage imageNamed:@"TouchAreaTouched"];
                if ([touchArea2.layer.presentationLayer hitTest:location2]) {
                    touchArea2.image = [UIImage imageNamed:@"TouchAreaTouched"];
                                timerTouch = 10;
                touchTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0) target:self selector:@selector(randomVoid) userInfo:nil repeats:YES];
                } }}
        }
    
    
    -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
        NSSet *allTouches = [event allTouches];
        for (UITouch *touch in allTouches)
    
    
    
              {
                CGPoint location = [touch locationInView:touch.view];
                  if (![touchArea.layer.presentationLayer hitTest:location]&&![touchArea2.layer.presentationLayer hitTest:location]) {
                      touchArea.image = [UIImage imageNamed:@"TouchArea"];
                      touchArea2.image = [UIImage imageNamed:@"TouchArea"];
                      [touchTimer invalidate];
                  }
    
                     }
    }
    
    
    -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    
        touchArea.image = [UIImage imageNamed:@"TouchArea"];
        touchArea2.image = [UIImage imageNamed:@"TouchArea"];
    
        [touchTimer invalidate];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to record the time when the user send everyone of a series
everyone! I need this layout position for my application in Sencha Touch 2. Code
Hello everyone I would have a value for the need to save every time
everyone! I need to track event when user is clicking maximumBox in window. It
Good day to everyone! I need to stop method execution until another activity will
I need to grant rights to Windows user group Everyone to the HKCR hive
Morning again..., Sorry to bother everyone but I need more help... I haven't done
Hi everyone new to MVC and I need to trim some %20's off of
Ahoy hoy everyone :) Here is a list of links. You will need it
Hello everyone i need some help. I'm trying to make an application for mac

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.