Directly on the code:
////VIEWCONTROLLER.M//Password Error--jitter animation////Created by Liu Zhiwu on 16/8/6.//copyright©2016 year Zhiwuliu. All rights reserved.//#import "ViewController.h"@interfaceViewcontroller ()@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; //additional setup after loading the view, typically from a nib.UILabel*label = [[UILabel alloc]initwithframe:cgrectmake ( -, -, $, -)]; Label.backgroundcolor=[Uicolor Purplecolor]; Label.tag= +; [Self.view Addsubview:label]; }-(void) Touchesbegan: (Nsset<uitouch *> *) touches withevent: (Uievent *)Event{UILabel*label = [Self.view viewwithtag: +]; [Self Shakeanimationforview:label]; }#pragmaMark Jitter Animation-(void) Shakeanimationforview: (UIView *) view{//gets to the current viewCalayer *viewlayer =View.layer; //get the current view locationCgpoint position =viewlayer.position; //two end locations to moveCgpoint x = cgpointmake (position.x +5, POSITION.Y); Cgpoint y= Cgpointmake (Position.x-5, POSITION.Y); //Set AnimationCabasicanimation *animation = [cabasicanimation animationwithkeypath:@"position"]; //set the form of motion[animation settimingfunction:[camediatimingfunction functionwithname:kcamediatimingfunctioneaseineaseout]; //Set Start position[animation Setfromvalue:[nsvalue valuewithcgpoint:x]; //Set End Position[animation Settovalue:[nsvalue valuewithcgpoint:y]; //Set auto-invert[animation Setautoreverses:yes]; //Set the time[Animation setduration:. .]; //Number of settings[Animation Setrepeatcount:3]; //Add on animation[Viewlayer addanimation:animation Forkey:nil]; }- (void) didreceivememorywarning {[Super didreceivememorywarning]; //Dispose of any resources the can be recreated.}@end
ios--input password is wrong, jitter