implement the Shake effect of delete button in Mac, use the core animation note! Attention! Attention!!! Here in the agent inside set is the key Ah!! [Self.window.contentView Setwantslayer:yes]; Setwantslayer must be set to Yes- (void) Applicationdidfinishlaunching: (Nsnotification *) anotification {//Insert code here to initialize your application[Self.window.contentView Setwantslayer:yes]; [Self.closeWindow.layer Setanchorpoint:nsmakepoint (0.5,0.5)]; Cabasicanimation*animation = [Cabasicanimation animationwithkeypath:@"transform.rotation.z"]; //set properties, period duration[Animation setduration:0.08]; //jitter AngleAnimation.fromvalue = @ (-m_1_pi/2); Animation.tovalue= @ (m_1_pi/2); //number of repetitions, infinitely largeAnimation.repeatcount =Huge_val; //back to the originalAnimation.autoreverses =YES; //Anchor Point set to Image Center, jitter around centerSelf.closeWindow.layer.anchorPoint = Cgpointmake (0.5,0.5); [Self.closeWindow.layer addanimation:animation Forkey:@"Rotation"];}
Mac-implements the shake effect of the Delete button