Recently idle to boredom, studied the iphone desktop icon jitter, the Internet has a similar case, but I think the effect is really bad, I also write a play, the need for small partners can refer to.
Imitation iOS icon jitter
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 The |
#import "LHViewController.h" #define Angeltorandian (x ) ((x)/180.0*m_pi) @interface Lhviewcontroller () @property (Strong, nonatomic) Iboutlet Uiimageview; @end @implementation Lhviewcontroller-(void) viewdidload {[Super viewdidload];//Do any additional the setup after loading The view, typically from a nib. uilongpressgesturerecognizer* Longpress=[[uilongpressgesturerecognizer alloc]initwithtarget:self Action: @selector (longpress:)]; [Self.imageview addgesturerecognizer:longpress]; }-(void) Longpress: (uilongpressgesturerecognizer*) longpress {if (Longpress.state==uigesturerecognizerstatebegan) { cakeyframeanimation* anim=[cakeyframeanimation Animation]; anim.keypath=@ "Transform.rotation"; anim.values=@[@ (Angeltorandian ( -7)), @ (Angeltorandian (7)), @ (Angeltorandian (-7))]; Anim.repeatcount=maxFLOAT; anim.duration=0.2; [Self.imageView.layer Addanimation:anim Forkey:nil]; Self.btn.hidden=no; }-(Ibaction) Delete: (ID) Sender {[Self.imageview removefromsuperview]; [Self.btn Removefromsuperview]; @end |
The above is the entire contents of this article, I hope you can enjoy.