我在应用程序中使用了CATransition动画,它可以正常工作,但有时会崩溃。

这是我的代码:

-(void)_close_btn_click:(UIButton*)button
{

  NSLog(@"update Button %ld clicked.",(long int)[button tag]);
  NSInteger intvalue=[[NSString stringWithFormat:@"%ld",(long int)[button tag]]intValue];
  NSLog(@"delete_index:%d",intvalue);
  CATransition* transition = [CATransition animation];
  [transition setDuration:1.0];
  transition.type = @"rippleEffect";
  transition.subtype = kCATransitionFromLeft;
  transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];

  [cell._slide_view.layer addAnimation:transition forKey:@"push-transition"];
  CATransition* transition1 = [CATransition animation];
  [transition1 setDuration:1.0];
  transition1.type = @"rippleEffect";
  transition1.subtype = kCATransitionFromLeft;
  [cell._en_cell_close_btn.layer addAnimation:transition forKey:@"push-transition"];
  cell._slide_view.hidden=YES;
}

最佳答案

我想也许您的cell_slide_view在调用此方法之前已被释放

关于iphone - CATransition动画有时会崩溃,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13488548/

10-08 20:53