Imitation iOS icon jitter
#import "LHViewController.h" #define Angeltorandian (x) ((x)/180.0*m_pi) @interface Lhviewcontroller () @property (
Strong, Nonatomic) Iboutlet Uiimageview *imageview;
@end @implementation Lhviewcontroller-(void) viewdidload {[Super viewdidload];
Do no additional 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.