iOS 15th day (1, drag-and-drop of event-handling view)

Source: Internet
Author: User

View some methods

#import "HMView.h"@implementationHmview//a complete touch process//Touchesbegan, touchesmoved, touchesended/*Nsarray set ordered Nsset disorder*///Touch Start- (void) Touchesbegan: (Nsset *) touches withevent: (Uievent *)Event{    //get a UitouchUitouch *touch =[touches anyobject]; //NSLog (@ "%s----%d", __func__,touches.count);//NSLog (@ "%d", touch.tapcount);//NSLog (@ "%d", touch.phase);}//Finger Movement- (void) touchesmoved: (Nsset *) touches withevent: (Uievent *)Event{    //get a UitouchUitouch *touch =[touches anyobject]; //get the current locationCgpoint current =[Touch locationinview:self]; //Get previous pointCgpoint pre =[Touch previouslocationinview:self]; //x-axis offsetCGFloat OffsetX = current.x-pre.x; CGFloat OffsetY= Current.y-pre.y; NSLog (@"%@", Nsstringfromcgpoint (current)); //get the center of a viewCgpoint Center =Self.center; Center.x+=OffsetX; Center.y+=OffsetY; Self.center=Center;}//Touch End- (void) touchesended: (Nsset *) touches withevent: (Uievent *)Event{    //get a UitouchUitouch *touch =[touches anyobject];//NSLog (@ "%d", touch.phase);//NSLog (@ "%s----%p", __func__,touch);}//The touch was interrupted, like calling.- (void) touchescancelled: (Nsset *) touches withevent: (Uievent *)Event{    }@end

iOS 15th day (1, drag-and-drop of event-handling view)

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.