Now you may easily implement the concept of Asynchronus Image loading on your iphone application.
We all know that when a table view has several images then first it has to download all the images from internet after then tabel view appears.
In this example LoadImageFromURL will return right away, the image will load in the background, and will automatically appear in the view when its finished downloading. Before the image is downloaded, it will show a default placeholder image and it can be set inside the code of 'AsyncImage.m' file-
}else {// Use a default placeholder when no cached image is foundUIImageView *imageView = [[[UIImageView alloc] initWithImage:[UIImageimageNamed:@"placeholder.png"]] autorelease];imageView.contentMode = UIViewContentModeScaleAspectFit;imageView.autoresizingMask =UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;[self addSubview:imageView];imageView.frame = self.bounds;[imageView setNeedsLayout];[self setNeedsLayout];}
And if you want to set a ActivityView during the image download, you may also set that-
UIActivityIndicatorView *spinny = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];spinny.tag = SPINNY_TAG;spinny.center = self.center;[spinny startAnimating];[self addSubview:spinny];[spinny release];
Find an easygoing sample app here.
3 comments:
Please let me know if you're looking for a article author for your blog. You
have some really great posts and I think I would be a good asset. If you ever want to take
some of the load off, I'd really like to write some articles for your blog in
exchange for a link back to mine. Please send me an email if interested.
Many thanks!
my web page - gunche.Blogspot.co.uk
Nice weblog right here! Additionally your website loads up very fast!
What host are you the use of? Can
I get your affiliate hyperlink for your host? I desire my website loaded up as quickly
as yours lol
My web blog ... all that jazz radio spain
Does your website have a contact page? I'm having problems locating it but, I'd like to
send you an email. I've got some suggestions for your blog you
might be interested in hearing. Either way, great site and I look forward to seeing it improve over time.
My site ... thecouponreview.com
Post a Comment