Ios 自定义动画后的UIButton操作

Ios 自定义动画后的UIButton操作,ios,objective-c,uibutton,Ios,Objective C,Uibutton,我想用UIButton连接自定义动画,所以我决定用超类UIButton创建自己的类。然后我开始这样做 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ [UIView animateKeyframesWithDuration:0.5 delay:0 options: 0

我想用UIButton连接自定义动画,所以我决定用超类UIButton创建自己的类。然后我开始这样做

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
[UIView animateKeyframesWithDuration:0.5
                               delay:0
                             options: 0
                          animations:^{

                              [UIView addKeyframeWithRelativeStartTime:0
                                                      relativeDuration:0.5
                                                            animations:^{
                                                                self.transform = CGAffineTransformScale(self.transform, 0.7, 0.7);
                                                            }];

                              [UIView addKeyframeWithRelativeStartTime:0.5
                                                      relativeDuration:0.5
                                                            animations:^{
                                                                self.transform = CGAffineTransformIdentity;
                                                            }];

                          }
                          completion:^(BOOL finished) {
                              [super touchesBegan:touches withEvent:event];
                          }];}
动画效果很好,但之后什么也没发生。在完成处理程序中调用超级方法似乎不起作用(不知道为什么)。我的问题是:我可以改变什么,以类似的方式创建自己的类


编辑:我想创建自己的类,因为我的应用程序中有很多按钮,我希望它们的行为相同。

ui按钮操作通常分配给在UIControlEventTouchUpInside上激发,这应该在touchesEnded方法中进行,而不是ToucheSbegind。

动画完成后您希望发生什么?您没有需要创建一个自定义按钮来执行此操作。只需使用标准按钮在“触碰向下”或“触碰向上”时启动动画,然后将要在动画之后运行的任何代码放在“完成”块中。