{"id":556,"date":"2017-09-14T06:32:11","date_gmt":"2017-09-14T06:32:11","guid":{"rendered":"http:\/\/mitat.tuu.fi\/?p=556"},"modified":"2017-09-14T06:33:28","modified_gmt":"2017-09-14T06:33:28","slug":"ios-touchesended-for-multitouch-single-finger-release","status":"publish","type":"post","link":"http:\/\/mitat.tuu.fi\/?p=556","title":{"rendered":"iOS touchesEnded for multitouch single finger release"},"content":{"rendered":"<p>If you need to know which finger actually were lifted from screen when doing a multiple touch tracking, you need to check the <strong>phase<\/strong> variable from UITouch to see if it has been actually lifted from screen. If the single touch has ended, it&#8217;s phase will be <strong>UITouchPhaseEnded<\/strong><\/p>\n<p>Normally when you lift one finger, the <strong>touchesEnded<\/strong> is called with a set of all active touches. I wish it would be a set of only touches that have ended. <\/p>\n<p>Example code:<\/p>\n<p><code>- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;<br \/>\n{<br \/>\n    NSSet *allTouches = [event allTouches];<\/p>\n<p>    for (int zz=0;zz<[allTouches count];zz++)\n    {\n        UITouch *touch = [[allTouches allObjects] objectAtIndex:zz];\n        \n        CGPoint touchPos = [touch locationInView:self];\n        \n        if (touch.phase==UITouchPhaseEnded)\n        {\n\n\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you need to know which finger actually were lifted from screen when doing a multiple touch tracking, you need to check the phase variable from UITouch to see if it has been actually lifted from screen. If the single touch has ended, it&#8217;s phase will be UITouchPhaseEnded Normally when you lift one finger, the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,4,5],"tags":[],"class_list":["post-556","post","type-post","status-publish","format-standard","hentry","category-cocoa","category-code","category-iphone"],"_links":{"self":[{"href":"http:\/\/mitat.tuu.fi\/index.php?rest_route=\/wp\/v2\/posts\/556","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/mitat.tuu.fi\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/mitat.tuu.fi\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/mitat.tuu.fi\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/mitat.tuu.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=556"}],"version-history":[{"count":2,"href":"http:\/\/mitat.tuu.fi\/index.php?rest_route=\/wp\/v2\/posts\/556\/revisions"}],"predecessor-version":[{"id":558,"href":"http:\/\/mitat.tuu.fi\/index.php?rest_route=\/wp\/v2\/posts\/556\/revisions\/558"}],"wp:attachment":[{"href":"http:\/\/mitat.tuu.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/mitat.tuu.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=556"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/mitat.tuu.fi\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}