Five big gestures

Source: Internet
Author: User

Click to pack

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initwithtarget:self Action: @selector (tick:)];

Number of fingers tapping the screen

tap.numberoftapsrequired = 1;

Several finger clicks

tap.numberoftouchesrequired = 1;

[Self.view Addgesturerecognizer:tap];

Long Press

Uilongpressgesturerecognizer *longpress = [[Uilongpressgesturerecognizer alloc]initwithtarget:self Action: @selector (loagpress:)];

Minimum number of seconds to press

Longpress.minimumpressduration = 3;

[Self.view addgesturerecognizer:longpress];

Swipe

Uiswipegesturerecognizer *swipe = [[Uiswipegesturerecognizer alloc]initwithtarget:self Action: @selector (swipe:)];

Direction of Swipe

Swipe.direction = Uiswipegesturerecognizerdirectionleft;

[Self.view Addgesturerecognizer:swipe];

Drag

Uipangesturerecognizer *pan = [[Uipangesturerecognizer alloc]initwithtarget:self Action: @selector (pan:)];

[Pan Requiregesturerecognizertofail:swipe];

[Self.view Addgesturerecognizer:pan];

Kneading

Uipinchgesturerecognizer *pinch = [[Uipinchgesturerecognizer alloc]initwithtarget:self Action: @selector (pinch:)];

[Self.view Addgesturerecognizer:pinch];

Rotating

Uirotationgesturerecognizer *rotation = [[Uirotationgesturerecognizer alloc]initwithtarget:self Action: @selector ( Rotation:)];

Rotation.rotation = 1;

[Self.view addgesturerecognizer:rotation];

}

-(void) TICK: (UITapGestureRecognizer *) tap

{

6, again out of the place to start this object to hang agent

Nextviewcontroller *next = [[Nextviewcontroller alloc]init];

Next.delegate = self;

//

[Self presentviewcontroller:next animated:yes completion:nil];

Imageview.transform = cgaffinetransformidentity;

Get the location of the tap screen

NSLog (@ "tap%f%f", [tap Locationinview:self.view].x,[tap locationinview:self.view].y);

Imageview.image = [UIImage imagenamed:@ "yu.jpg"];

Imageview.alpha = 1;

Imageview.center = [Tap LocationInView:self.view];

[UIView animatewithduration:0.5 animations:^{

Imageview.alpha = 0.01;

}];

}

-(void) mmmmmm

{

Imageview.image = [UIImage imagenamed:@ "yu.jpg"];

Imageview.alpha = 1;

}

-(void) Loagpress: (Uilongpressgesturerecognizer *) longpress

{

NSLog (@ "longpress%f%f", [longpress locationinview:self.view].x,[longpress locationinview:self.view].y);

}

-(void) Swipe: (Uiswipegesturerecognizer *) swipe

{

NSLog (@ "swipe%f%f", [swipe locationinview:self.view].x,[swipe locationinview:self.view].y);

Self.view.frame = CGRectMake (self.view.bounds.size.width, 0, Self.view.bounds.size.width, Self.view.bounds.size.height);

[UIView animatewithduration:0.8 animations:^{

Self.view.frame = CGRectMake (0, 0, self.view.bounds.size.width, self.view.bounds.size.height);

}];

}

-(void) pan: (Uipangesturerecognizer *) pan

{

Get the location of the drag

Imageview.image = [UIImage imagenamed:@ "yu.jpg"];

Imageview.alpha = 1;

Imageview.center = [Pan LocationInView:self.view];

}

-(void) Pinch: (Uipinchgesturerecognizer *) pinch

{

Imageview.image = [UIImage imagenamed:@ "yu.jpg"];

Imageview.alpha = 1;

Imageview.transform = Cgaffinetransformscale (Imageview.transform, Pinch.scale, Pinch.scale);

Scale of changes in kneading

Pinch.scale = 1;

}

-(void) Rotation: (Uirotationgesturerecognizer *) rotation

{

Imageview.image = [UIImage imagenamed:@ "yu.jpg"];

Imageview.alpha = 1;

Change the view rotation on a rotation gesture

Imageview.transform = Cgaffinetransformmakerotation (rotation.rotation);

}

Five big gestures

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.