cocoaTouch/MapConfigViewController.m
changeset 3513 f589230fa21b
parent 3495 a6b4f351d400
equal deleted inserted replaced
3512:6a8b5f313190 3513:f589230fa21b
   118     CGImageRef previewCGImage = CGBitmapContextCreateImage(bitmapImage);
   118     CGImageRef previewCGImage = CGBitmapContextCreateImage(bitmapImage);
   119     UIImage *previewImage = [[UIImage alloc] initWithCGImage:previewCGImage];
   119     UIImage *previewImage = [[UIImage alloc] initWithCGImage:previewCGImage];
   120     CGImageRelease(previewCGImage);
   120     CGImageRelease(previewCGImage);
   121 
   121 
   122     // set the preview image (autoreleased) in the button and the maxhog label on the main thread to prevent a leak
   122     // set the preview image (autoreleased) in the button and the maxhog label on the main thread to prevent a leak
   123     [self performSelectorOnMainThread:@selector(setButtonImage:) withObject:[previewImage makeRoundCornersOfSize:CGSizeMake(12, 12)] waitUntilDone:NO];
   123     [self performSelectorOnMainThread:@selector(setButtonImage:) withObject:[[previewImage retain] makeRoundCornersOfSize:CGSizeMake(12, 12)] waitUntilDone:NO];
   124     [self performSelectorOnMainThread:@selector(setLabelText:) withObject:[NSString stringWithFormat:@"%d", maxHogs] waitUntilDone:NO];
   124     [self performSelectorOnMainThread:@selector(setLabelText:) withObject:[NSString stringWithFormat:@"%d", maxHogs] waitUntilDone:NO];
   125     
   125     
   126     // restore functionality of button and remove the spinning wheel on the main thread to prevent a leak
   126     // restore functionality of button and remove the spinning wheel on the main thread to prevent a leak
   127     [self performSelectorOnMainThread:@selector(turnOnWidgets) withObject:nil waitUntilDone:NO];
   127     [self performSelectorOnMainThread:@selector(turnOnWidgets) withObject:nil waitUntilDone:NO];
   128     
   128     
   281     
   281     
   282     if (self.segmentedControl.selectedSegmentIndex != 1) {
   282     if (self.segmentedControl.selectedSegmentIndex != 1) {
   283         // the % prevents a strange bug that occurs sporadically
   283         // the % prevents a strange bug that occurs sporadically
   284         NSString *themeName = [self.themeArray objectAtIndex:row % [self.themeArray count]];
   284         NSString *themeName = [self.themeArray objectAtIndex:row % [self.themeArray count]];
   285         cell.textLabel.text = themeName;
   285         cell.textLabel.text = themeName;
   286         UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/Icon.png",THEMES_DIRECTORY(),themeName]];
   286         UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),themeName]];
   287         cell.imageView.image = image;
   287         cell.imageView.image = image;
   288         [image release];
   288         [image release];
   289     } else {
   289     } else {
   290         cell.textLabel.text = [self.mapArray objectAtIndex:row];
   290         cell.textLabel.text = [self.mapArray objectAtIndex:row];
   291         cell.imageView.image = nil;
   291         cell.imageView.image = nil;