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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:23:51+00:00 2026-06-04T15:23:51+00:00

I’m using this method to move my objects in view: – (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent

  • 0

I’m using this method to move my objects in view:

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event

In this method I wrote next:

NSLog(@"event: %@", event);

and get this result:

event: <UITouchesEvent: 0x310d00> timestamp: 5277.16 touches: {(
    <UITouch: 0x3f1110> phase: Moved tap count: 1 window: <UIWindow: 0x3117d0; frame = (0 0; 768 1024); layer = <UIWindowLayer: 0x30cb20>> view: <UIView: 0x330520; frame = (0 0; 768 1024); transform = [0, -1, 1, 0, 0, 0]; autoresize = W+H; layer = <CALayer: 0x330550>> location in window: {279, 677} previous location in window: {305, 694} location in view: {347, 279} previous location in view: {330, 305},
    <UITouch: 0x4a1a710> phase: Stationary tap count: 1 window: <UIWindow: 0x3117d0; frame = (0 0; 768 1024); layer = <UIWindowLayer: 0x30cb20>> view: (null) location in window: {412, 89} previous location in window: {413, 89} location in view: {412, 89} previous location in view: {413, 89}
)}

In this log I can see all my touches (for now this is two touches).

My questions is how to get for touch?

This needs to move my objects.

Now I’m using this:

UITouch *touch = [[event allTouches] anyObject];
CGPoint touchLocation = [touch locationInView:self.view];

But when I move my object I get all values of touches. How to handle just first touch?

Thanks a lot!

  • 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-04T15:23:52+00:00Added an answer on June 4, 2026 at 3:23 pm

    There’s nothing wrong with the way you do it, but if you’d really like to know, how to get the very first object, here it goes.

    Parameter touches is of NSSet type. If you take a look at NSSet Class Reference you can also find a method - (NSArray *)allObjects.

    So you could retrieve first touch by:

    UITouch *touch = (UITouch *)[[[event allTouches] allObjects] objectAtIndex: 0];
    

    Also take a look at UIEvent Class Reference. There you’ll find that allTouches is not the only method. Class also knows how to return:

    - (NSSet *)touchesForGestureRecognizer:(UIGestureRecognizer *)gesture
    
    - (NSSet *)touchesForView:(UIView *)view
    
    - (NSSet *)touchesForWindow:(UIWindow *)window
    

    All of this methods return a NSSet. Which you can convert to NSArray using NSSet‘s allObjects method.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.