i m pulling an image from an url and showing it in an imageview.what i want is an fadein animation effect when the image gets loaded from the url.i m using a background threading below is the code..
NSOperationQueue *theQueue=[[[NSOperationQueue alloc]init]autorelease];
NSInvocationOperation *theOp=[[NSInvocationOperation alloc]initWithTarget:self selector:@selector(loadImage) object:nil];
[theQueue addOperation:theOp];
}
-(void)loadImage
{
NSAutoreleasePool *pool=[[NSAutoreleasePool alloc]init];
[activityIndicator startAnimating];
NSString *imagefile = [image objectAtIndex:0];
NSURL *url1=[NSURL URLWithString:imagefile];
NSData *data = [NSData dataWithContentsOfURL:url1];
UIImage *ui=[[UIImage alloc]initWithData:data];
NSLog(@"awesome:%@",ui);
[ui beginAnimations:@"" context:nil];
bigbanner.image=ui;
[activityIndicator stopAnimating];
[pool release];
}
Yes what you say is absolutely correct and thats the way to do it. I wrote this method & always use this to Fade in my image. I deal with CALayer for this. You need to import Quartz framework for this.
Usage: If you are using this from your current file, then –
Hope this helps