J'essaie de libérer la memory de mes applications et je veux supprimer complètement loadImageView de la memory quand j'appuie sur un button. Comment puis-je faire cela?
-(IBAction)animationOneStart { NSMutableArray *images = [[NSMutableArray alloc] initWithCapacity:88]; for(int count = 1; count <= 88; count++) { NSSsortingng *fileName = [NSSsortingng ssortingngWithFormat:@"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? }
Merci!
D'accord. Si vous voulez supprimer l'animation UIImageView, essayez ceci:
-(IBAction)removeFromMemory { [loadingImageView stopAnimating]; //here animation stops [loadingImageView removeFromSuperview]; // here view removes from view hierarchy [loadingImageView release]; loadingImageView = nil; //clean memory }
Pour supprimer CoreAnimation de la méthode d'utilisation de l'instance UIView:
[view.layer removeAllAnimations];