Memory growing and growing when using UIImageView's image
Memory growing and growing when using UIImageView's image
- Subject: Memory growing and growing when using UIImageView's image
- From: Gustavo Pizano <email@hidden>
- Date: Tue, 17 May 2011 22:28:11 +0200
Hello.
UI have 2 UUIImageView which Im sliding in/out to display some images, but each time the new image slides in the memory keeps growing and growing and growing even I set to nil the image of the outgoing UIImageview.
This is what Im doing.
Please any help will be very appreciate it.
-(void)nextImage{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
if(indexActualImage +1 < [images count]){
if(self.currentImageView.superview){
indexActualImage ++;
self.nextImageView.image = [UIImage imageNamed:[[images objectAtIndex:indexActualImage]bigImageName]];
CGRect bounds = self.view.bounds;
bounds.origin= CGPointMake(bounds.size.width,0);
self.nextImageView.frame = bounds;
[self.view insertSubview:self.nextImageView belowSubview:toolBarView];
[UIView animateWithDuration:0.5
animations:^{
self.currentImageView.center = CGPointMake(-self.currentImageView.bounds.size.width/2, self.currentImageView.center.y);
self.nextImageView.center = CGPointMake(self.nextImageView.bounds.size.width/2, self.nextImageView.center.y);
}
completion:^(BOOL finished){
self.currentImageView.image = nil;
[self.currentImageView removeFromSuperview];
[self performSelector:@selector(fireTimer) withObject:nil afterDelay:4.0];
}];
}
else if(self.nextImageView.superview){
indexActualImage ++;
self.currentImageView.image = [UIImage imageNamed:[[images objectAtIndex:indexActualImage]bigImageName]];
CGRect bounds = self.view.bounds;
bounds.origin= CGPointMake(bounds.size.width,0);
self.currentImageView.frame = bounds;
[self.view insertSubview:self.currentImageView belowSubview:toolBarView];
[UIView animateWithDuration:0.5
animations:^{
self.nextImageView.center = CGPointMake(-self.nextImageView.bounds.size.width/2, self.nextImageView.center.y);
self.currentImageView.center = CGPointMake(self.currentImageView.bounds.size.width/2, self.currentImageView.center.y);
}
completion:^(BOOL finished){
self.nextImageView.image = nil;
[self.nextImageView removeFromSuperview];
[self performSelector:@selector(fireTimer) withObject:nil afterDelay:4.0];
}];
}
}
else{
indexActualImage = -1;
[self nextImage];
}
[pool drain];
}
Regards
Gustavo
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden