[Original] Open Source China Reading Note

Source: Internet
Author: User

First, let's take a look at the TableView method for getting the cell instance.

-(UITableViewCell *) tableView :( UITableView *) tableView cellForRowAtIndexPath :( NSIndexPath *) indexPath

Code involving Cell instantiation:

PostCell *cell = (PostCell * (!                NSArray *objects = [[NSBundle mainBundle] loadNibNamed: (NSObject *o ([o isKindOfClass:[PostCell = (PostCell **singleTap =            cell.img.image = [UIImage imageNamed:*p = ([cell.img.gestureRecognizers count] > *tap = (UITap *)[cell.img.gestureRecognizers objectAtIndex:                    tap.tag == self.catalog <=  ?  : == [UIFont boldSystemFontOfSize:= [NSString stringWithFormat:= [NSString stringWithFormat:                cell.img.image =  ([p.img isEqualToString:= [UIImage imageNamed:                    NSData * imageData ===                        IconDownloader *downloader = [imageDownloadsInProgress objectForKey:[NSString stringWithFormat: (downloader ==                            ImgRecord *record = [ImgRecord = cell;

Next, the implementation in startIconDownload: forIndexPath: Is to do the following:

1. instantiate IconDownloader and set it to imageDownloadsInProgress

2. iconDownloader instances use

NSURLConnection *conn =:self];

Asynchronous request

3. When the conn execution is complete, execute its delegate-IconDownloader finish method and cache the image

4. In the finish method, call delegate-PostView to render ImageData to image (png) data through UIImagePNGRepresentation, and call [tablePosts reloadData]

 

Here, it is worth noting: Is the reloadData method called once after each image is loaded optimal?

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.