1. 程式人生 > >uiview動畫閃現問題

uiview動畫閃現問題

如果不能確定記憶體釋放,最好不要使用uiview動畫

建議簡單的直線動畫使用,cabasicanimation

CABasicAnimation  * translation = [CABasicAnimation animationWithKeyPath:@"position"];

        translation.delegate = self;
        ///從螢幕外開始
        translation.fromValue = [NSValue valueWithCGPoint:CGPointMake(kYBScreenWidth + animate_View.frame.size.width/2, animate_View.center.y)];
        translation.toValue = [NSValue valueWithCGPoint:CGPointMake(-animate_View.frame.size.width/2, animate_View.center.y)];
        //         translation.byValue = [NSValue valueWithCGPoint:CGPointMake(announceView.frame.size.width/2, announceView.center.y)];
        translation.removedOnCompletion = NO;
        translation.fillMode = kCAFillModeForwards;
        translation.duration = 5;//動畫持續時間 跟後面的延遲方法差一秒是 駐留時間
        translation.repeatCount = 1;//動畫重複次數
        translation.autoreverses = NO;//是否自動重複
        [animate_View.layer addAnimation:translation forKey:@"translation"];
        [self performSelector:@selector(removeAnimate_View) withObject:nil afterDelay:5.1];