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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:16:26+00:00 2026-05-27T11:16:26+00:00

When touch began-it shows the image,when touchmoved the image follows the touch events, when

  • 0

enter image description here

When touch began-it shows the image,when touchmoved the image follows the touch events, when touch ended the image disappear

 - (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { 
        [super touchesBegan:touches withEvent:event];
        newgicg.hidden = NO;
        NSArray *allTouches = [touches allObjects]; 
        UITouch *touch = [touches anyObject];
        CGPoint touchLocation = [touch locationInView:touch.view];
        int count = [allTouches count];
        if (count == 1) {

            newgicg.center = touchLocation;           

            }

    } 

    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
        [super touchesMoved:touches withEvent:event];

        UITouch *touch = [touches anyObject];
        CGPoint touchLocation = [touch locationInView:touch.view];

         newgicg.center = touchLocation;     

       [self.view addSubview:newgicg];
    }

    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
        [super touchesEnded:touches withEvent:event];

         newgicg.hidden = YES;


    }

I want something like ,to follow the collection of stars when the cursor moved on the screen.i want the stars to be blinks and vanished wherever the cursor goes on the screen

  • 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-27T11:16:27+00:00Added an answer on May 27, 2026 at 11:16 am
    - (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { 
        [super touchesBegan:touches withEvent:event];
    
    } 
    
    
    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
        [super touchesMoved:touches withEvent:event];
    
        UITouch *touch = [touches anyObject];
        CGPoint touchLocation = [touch locationInView:touch.view];
        UIImageView *imageView=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"simple-apple.png"]];
        imageView.center = touchLocation;    
        [self.view addSubview:imageView];
        [imageView release];
    
    }
    
    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
        [super touchesEnded:touches withEvent:event];
        for (UIView *view in [self.view subviews]) {
            [view removeFromSuperview];
        }
    
    }
    

    try this code instead, just replace the name of the image.

    EDIT:
    one thing I forgot to mention is that you can keep a counter to the no. of subviews added this way and remove them , otherwise it may also remove other views which were there on the view before.

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

Sidebar

Related Questions

I have subclassed a UIImageView, and have implemented touchesBegan/Moved/Finished like this: - (void)touchesBegan:(NSSet *)touches
I subclassed uiscrollview and overrode the touch began method to pass touch events to
I have used 4 images and use touches began method to detect user's touch
i am using a uiview parent view....overidded touch began and touch ended methods... when
I can't work out how to pass the touch location in touch began into
I have been using touches began to track as many as 8 touches, and
Is there any method in objective-c to find the time between touch began and
i touch down at same time with two fingers. i get [touches count]=>1 and
I have been using the following method to detect when a touch began and
I've subclassed UITableView (as KRTableView) and implemented the four touch-based methods (touchesBegan, touchesEnded, touchesMoved,

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.