#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 any 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]; [email protected] "transform.rotation"; [ email protected][@ (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 following are the results of the program running:
Dithering of icons in imitation iOS