iOS Multi-Touch traversal

Source: Internet
Author: User

Case: Draw paths and clear paths based on multi-touch images.

Gets the coordinates of the main coordinate set ImageView.

The view does not support multi-touch by default: set to support multitouch:[Self. View setmultipletouchenabled:YES];

1. Looping Create ImageView
4- (void) touchesmoved: (Nsset *) touches withevent: (Uievent *)Event5 {6Nsinteger i =0;7      for(Uitouch *touchinchtouches) {8Uiimageview *imageview =[[Uiimageview Alloc]initwithimage:self.imagedata[i]];9Cgpoint location =[Touch LocationInView:self.view];Ten [ImageView setcenter:location]; One [Self.view Addsubview:imageview]; Ai++; -     } -}

2. Clear Self.view
Iskindofclass:  to determine what type of control it is.
1 [ImageView setcenter:location];2 [Self.view Addsubview:imageview];3i++;4     }5 }6 7- (void) ClearView8 {9      for(Uiimageview *imageviewinchself.view.subviews) {Ten          One         if([ImageView Iskindofclass:[uiimageviewclass]]) { A[UIView animatewithduration:5.0fanimations:^{ -[ImageView Setalpha:0.1f]; -} completion:^(BOOL finished) { the [ImageView Removefromsuperview]; -             }] ; -         } -     } +}

iOS Multi-Touch traversal

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.