ios--input password is wrong, jitter

Source: Internet
Author: User

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

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.