ios - 如何从内存中完全删除 UIImageView 动画?

标签 ios

我正在尝试释放我的应用程序内存,并希望在我点击按钮时从内存中完全删除 loadingImageView。我该怎么做?

-(IBAction)animationOneStart { 

NSMutableArray *images = [[NSMutableArray alloc] initWithCapacity:88];

for(int count = 1; count <= 88; count++)
{
    NSString *fileName = [NSString stringWithFormat:@"testPic1_%03d.jpg", count];
    UIImage  *frame    = [UIImage imageNamed:fileName];
    [images addObject:frame];
}

loadingImageView.animationImages = images;

loadingImageView.animationDuration = 5;
loadingImageView.animationRepeatCount = 1; //Repeats indefinitely

[loadingImageView startAnimating];
[images release];

}

-(IBAction)removeFromMemory {

//What do I add here?

}

谢谢!

最佳答案

好的。如果你想删除 UIImageView 动画试试这个:

-(IBAction)removeFromMemory {
    [loadingImageView stopAnimating];    //here animation stops
    [loadingImageView removeFromSuperview];    // here view removes from view hierarchy
    [loadingImageView release]; loadingImageView = nil;    //clean memory  
}

要从 UIView 实例中删除 CoreAnimation,请使用方法:

[view.layer removeAllAnimations];

关于ios - 如何从内存中完全删除 UIImageView 动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7750378/

相关文章:

ios - 如何快速检测用户何时单击 lyft 按钮

ios - 在印度添加 Apple Pay 访问权限

ios - UItextfield 中的大写字符

iphone - Tapku 图书馆日历的奇怪时区问题

iphone - iOS,使用下划线与直接使用 iVar

ios - 使 iOS 应用程序出现在移动数据中,位于 'use mobile data for' 下

ios - 构建配置和目标之间有什么区别?

iOS:如何禁用 UIButton 的淡入淡出效果

ios - Swift2 中的 Firebase 身份验证匿名

ios - 即使打开闪光灯,AVCaptureOutput 也会拍出黑暗的照片