以下代码指向内存分配泄漏(使用分析器中的分配工具) - 有人可以指出原因 - 我正在使用 aCABAsicAnimation
来旋转 aUIImageView
-(void)SetGaugeToValueInAngles: (int)newValue
{
static int oldValue = 0;
int delta = newValue - oldValue;
CABasicAnimation *rotate = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
[rotate setDelegate:self];
rotate.fromValue = [NSNumber numberWithFloat:oldValue/57.2958];
rotate.removedOnCompletion = NO;
rotate.fillMode = kCAFillModeForwards;
rotate.toValue = [NSNumber numberWithFloat: newValue/57.2958];
rotate.duration = 10.0; // seconds
[self.UIImageViewPressureMark.layer addAnimation:rotate forKey:nil]; // "key" is optional
NSLog(@"Old Value %d New Value %d", oldValue, newValue);
oldValue = newValue;
}