代码之家  ›  专栏  ›  技术社区  ›  GuybrushThreepwood

iPhone核心动画运行不顺畅?

  •  0
  • GuybrushThreepwood  · 技术社区  · 14 年前

    我的应用程序中有以下核心动画代码:

    -(void)startCoreAnimation
    
        [UIView beginAnimations:@"IconFade" context:Icon];
       [UIView setAnimationCurve:UIViewAnimationCurveLinear];
       [UIView setAnimationDuration:1];
    
       [UIView setAnimationRepeatAutoreverses:YES];
       [UIView setAnimationDelegate:self];
       [UIView         setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
    
       icon.alpha=0.0;
       [UIView commitAnimations];
       break;
    

    然后当动画结束时:

    -(void)animationFinished : (NSString *)theAnimation finished : (BOOL)flag context : (void *)context {
    
    
     ((UIView *)context).alpha = 1.0;
     ((UIView *)context).transform = CGAffineTransformIdentity;
    
     [self startCoreAnimation];
    
    }
    

    谢谢,

    马丁

    1 回复  |  直到 14 年前
        1
  •  0
  •   Jeroen de Leeuw    14 年前

    如果只想循环动画,也可以使用

    [UIView setAnimationRepeatCount:1e100f];

    根据 documentation :

    使动画重复直到