An animation of a heartbeat
-(void) viewdidload {
[super viewdidload];
UIButton *heart = [[UIButton alloc]initwithframe:cgrectmake (Self.view.frame.size.width * 0.5-25, M, M)];
[Self.view Addsubview:heart];
[Heart setimage:[uiimage imagenamed:@ "5_heart"] forstate:uicontrolstatenormal];
[Heart setimage:[uiimage imagenamed:@ "5_heart_clicked"] forstate:uicontrolstateselected];
[Heart addtarget:self Action: @selector (Heartbuttonclick:) forcontrolevents:uicontroleventtouchupinside];
}
/**
* Heartbeat
/
(void) Heartbuttonclick: (UIButton *) button{
button.selected =! button.selected;
Cakeyframeanimation *k = [cakeyframeanimation animationwithkeypath:@ "Transform.scale"];
K.values = @[@ (0.1), @ (1.0), @ (1.5)];
K.keytimes = @[@ (0.0), @ (0.5), @ (0.8), @ (1.0)];
K.calculationmode = kcaanimationlinear;
[Button.layer addanimation:k forkey:@ "Show"];
}