Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 2.53 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. - (void)setCellData:(NSIndexPath *)fp8 {
  2.         NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  3.        
  4.         NSDictionary *cacheDict;
  5.        
  6.         if ([cacheFromDisk objectForKey:NUMBER(fp8.row)] != nil) {
  7.                 cacheDict = [[[NSDictionary alloc] initWithObjectsAndKeys:
  8.                                                                         [[cacheFromDisk objectForKey:NUMBER(fp8.row)] objectForKey:@"LeftAlbumName"], @"LeftAlbumName",
  9.                                                                         [[cacheFromDisk objectForKey:NUMBER(fp8.row)] objectForKey:@"LeftArtistName"], @"LeftArtistName",
  10.                                                                         [[cacheFromDisk objectForKey:NUMBER(fp8.row)] objectForKey:@"LeftCoverImage"], @"LeftCoverImage",
  11.                                                                         [[cacheFromDisk objectForKey:NUMBER(fp8.row)] objectForKey:@"RightAlbumName"], @"RightAlbumName",
  12.                                                                         [[cacheFromDisk objectForKey:NUMBER(fp8.row)] objectForKey:@"RightArtistName"], @"RightArtistName",
  13.                                                                         [[cacheFromDisk objectForKey:NUMBER(fp8.row)] objectForKey:@"RightCoverImage"], @"RightCoverImage", nil] autorelease];
  14.         }
  15.         else {
  16.                 cacheDict = [[[NSDictionary alloc] initWithObjectsAndKeys:
  17.                                                                         [self albumNameForItemAtIndex:fp8.row*2], @"LeftAlbumName",
  18.                                                                         [self albumArtistForItemAtIndex:fp8.row*2], @"LeftArtistName",
  19.                                                                         [self artworkImageAtIndex:fp8.row*2], @"LeftCoverImage",
  20.                                                                         [self albumNameForItemAtIndex:fp8.row*2+1], @"RightAlbumName",
  21.                                                                         [self albumArtistForItemAtIndex:fp8.row*2+1], @"RightArtistName",
  22.                                                                         [self artworkImageAtIndex:fp8.row*2+1], @"RightCoverImage", nil] autorelease];
  23.         }
  24.        
  25.         NSDictionary *infoDict = [[[NSDictionary alloc] initWithObjectsAndKeys:
  26.                                                            NUMBER(fp8.row), @"WhereToCache",
  27.                                                            cacheDict, @"WhatToCache", nil] autorelease];
  28.        
  29.         [self performSelectorOnMainThread:@selector(saveDictioneryToCache:) withObject:infoDict waitUntilDone:YES];
  30.        
  31.         CDLibraryTableViewCell *cell = (CDLibraryTableViewCell *)[self.tableView cellForRowAtIndexPath:fp8];
  32.         cell.leftAlbumName = [[cache objectForKey:NUMBER(fp8.row)] objectForKey:@"LeftAlbumName"];
  33.         cell.leftArtistName = [[cache objectForKey:NUMBER(fp8.row)] objectForKey:@"LeftArtistName"];
  34.         cell.rightCoverImage = [[cache objectForKey:NUMBER(fp8.row)] objectForKey:@"LeftCoverImage"];
  35.         cell.rightAlbumName = [[cache objectForKey:NUMBER(fp8.row)] objectForKey:@"RightAlbumName"];
  36.         cell.rightArtistName = [[cache objectForKey:NUMBER(fp8.row)] objectForKey:@"RightArtistName"];
  37.         cell.rightCoverImage = [[cache objectForKey:NUMBER(fp8.row)] objectForKey:@"RightCoverImage"];
  38.         [cell updateCell];
  39.        
  40.         if (fp8.row == 0)
  41.                 [self.tableView reloadData];
  42.        
  43.         if (fp8.row == rowsInTable-1)
  44.                 [self saveCacheToDisk];
  45.                
  46.         [pool release];
  47. }