Advertisement
Guest User

PhotoBrowser-Memory Issue

a guest
Jul 4th, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  2. {
  3.     RiparazioneTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
  4.     Customer_Document *document = (Customer_Document *)[self.documents objectAtIndex:indexPath.row];
  5.  
  6.     if (self.photoBrowser) {
  7.             [self.photoBrowser dismissViewControllerAnimated:YES completion:nil];
  8.             self.photoBrowser = nil;
  9.         }
  10.         NSArray *documentImagesLinks = [document imagesLinks];
  11.         if(documentImagesLinks.count > 0) {
  12.            
  13.             cell.imageTappedBlock = ^{
  14.                 NSMutableArray *documentImagesUrls = [[NSMutableArray alloc] init];
  15.                 for (Customer_Document_Link *imgLink in documentImagesLinks) {
  16.                     NSURL *remoteImageUrl = [imgLink remoteUrl];
  17.                     [documentImagesUrls addObject:remoteImageUrl];
  18.                 }
  19.                
  20.                 NSArray *photosToShow = [NSArray arrayWithArray:documentImagesUrls];
  21.                 documentImagesUrls = nil;
  22.                 NSLog(@"photo da visualizzare: %@",photosToShow);
  23.                 self.photoBrowser = [[IDMPhotoBrowser alloc] initWithPhotoURLs:photosToShow animatedFromView:self.view];
  24.                 [self.photoBrowser setUseWhiteBackgroundColor:true];
  25.                 [self.photoBrowser setDisplayToolbar:true];
  26.                 [self.photoBrowser setDisplayCounterLabel:true];
  27.                 [self.photoBrowser setDisplayArrowButton:true];
  28.                 self.photoBrowser.displayActionButton = false;
  29.                 self.photoBrowser.delegate = self;
  30.                
  31.                 [self presentViewController:self.photoBrowser animated:YES completion:nil];
  32.             };
  33.         }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement