Note that there are some explanatory texts on larger screens.

plurals
  1. POTableView VS Memory Warning
    primarykey
    data
    text
    <p>I'm using xcode 5 and ios 7. When I scroll to the end of the table, load the data asynchronously from the server (picture 50-100kb). After 10 attempts occur memory warning.... Asynch download with <strong>GCD</strong>. How to solve the problem and not lose smoothness of scroll content? Worked ARC with GCD? </p> <p>CellCreate :</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *cellID = [NSString stringWithFormat:@"Cell%i",indexPath.section]; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; /* First section simple text cell Second section hard cells */ if(cell == nil) { switch (indexPath.section) { case 0: { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; break; } case 1: { cell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; break; } default: { break; } } } if (indexPath.section == 1) { NSInteger index = indexPath.row; ModelInfo* model = [arrayModelInfo objectAtIndex:index]; [(CustomCell*)cell setContent:model];//Update subview in cell with parametrs model } cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; } </code></pre> <p>CustomCell setContent</p> <pre><code>[self.CustomConentView.imageView setImage:model.image]; [self.CustomConentView.label setText:model.name]; </code></pre> <p>Download:</p> <pre><code>NSInteger serverOffset = 0; ..... dispatch_async(queueDownloadData, ^{ [self backgroundDownloadRecometedProducts]; }); ..... - (void) backgroundDownload { Network* network = [[LMNetwork alloc] init]; [network getRecomendedProductOffset:serverOffset Success:^(id JSON) { dispatch_async(queueDownloadData, ^{ recomentedProductsOffset += 10; [self parse:JSON]; }); }]; } - (void) parse: (id) JSON { NSArray* result = [JSON objectForKey:@"result"]; for (NSDictionary* parametrs in result) { ModelInfo* model = [[ModelInfo alloc] initWithDictionary:parametrs]; [arrayModelInfo addObject:model]; dispatch_async(self.queueDownloadImages, ^{ [self downloadImageForName:model.thumbnail Tag:[arrayModelInfo indexOfObject:model]]; }); } dispatch_async(dispatch_get_main_queue(), ^{ [tableViewContent reloadData]; }); } - (void) downloadImageForName: (NSString*) imageName Tag: (NSInteger) tag { Network* network = [[Network alloc] init]; [network downloadImageWithName:imageName ImageTag:tag Success:^(UIImage *image, NSInteger tag) { ModelInfo* model = [arrayModelInfo objectAtIndex:tag]; model.image = image; dispatch_async(dispatch_get_main_queue(), ^{ [tableViewContent reloadData]; }); }]; } </code></pre> <p>In Network class post request in Server, I used AFNetworking</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload