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 (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com