Post

Replies

Boosts

Views

Activity

Reply to Cell with Image not refreshing
(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {     NSInteger rowTest; rowTest = [pickerView selectedRowInComponent:0]; NSString *inStr = [NSString stringWithFormat: @"%ld", (long)rowTest]; testPickSelectNew = [NSString stringWithFormat: @"%ld", (long)rowTest];     NSArray *checkAuctionVCR = [VehicleData valueForKey:@"AuctionVCR.AuctionVCR"]; if ([testPickSelectNew isEqual: @"1"]) { [self removePicker]; self.locationPersonDate.text = [dataArray objectAtIndex:row]; [self.vcrDamagesTable reloadData]; [self calculateTotalLabels]; eventAddress = @""; self.locationPersonDate.text = @""; [self loadEventInfo]; // _vcrDamagesTable.dataSource = nil; } else if ([testPickSelectNew isEqual: @"2"]) { [self removePicker]; self.locationPersonDate.text = [dataArray objectAtIndex:row]; [self.vcrDamagesTable reloadData]; [self calculateTotalLabels]; eventAddress = @""; self.locationPersonDate.text = @""; [self loadEventInfo]; // _vcrDamagesTable.dataSource = nil; } } (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (tableView == self.vcrDamagesTable) { VCRCell *vcrCell = [tableView dequeueReusableCellWithIdentifier:vcrDamagesTableViewCellIdentifier];   if (!vcrCell) vcrCell = [[VCRCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:vcrDamagesTableViewCellIdentifier]; if (!(indexPath.row [VehicleData vcrDamageItems].count)) return [UITableViewCell new];        NSDictionary *vcrDamageData = [VehicleData vcrDamageItems][indexPath.row]; // Hacking the existing method to cache additional images for VCR by creating a new VIN         vcrCell.cellVIN = [[VehicleData vin] stringByAppendingString:[NSNumber numberWithInteger:indexPath.row].stringValue];         vcrCell.imageURL = [NSURL URLWithString:vcrDamageData[@"PhotoURL"]];         [vcrCell.damagePhoto setImage:nil]; [vcrCell.damagePhoto loadVehicleImageForVIN:vcrCell.cellVIN imageURL:vcrCell.imageURL]; [vcrCell.damagePhoto setBackgroundColor:(vcrCell.imageURL.path.length? [UIColor colorWithWhite:0.75 alpha:0.5] : [UIColor clearColor])];  vcrCell.damageItem.text             = vcrDamageData[@"DamageItem"];         vcrCell.damageDescription.text      = vcrDamageData[@"Description"];         vcrCell.partsCost.text              = [vcrDamageData[@"Parts"] currency];         vcrCell.laborCost.text              = [vcrDamageData[@"Labor"] currency];         vcrCell.laborHours.text             = vcrDamageData[@"Hours"];         vcrCell.estimate.text               = [vcrDamageData[@"Estimate"] currency]; [vcrCell setBackgroundColor:[UIColor colorWithWhite:1.00f alpha:0.50f]];         vcrCell.delegate = self;          return vcrCell; }  return [UITableViewCell new]; }
Topic: UI Frameworks SubTopic: UIKit Tags:
Apr ’21
Reply to Cell with Image not refreshing
Issue was related to cache of images; below method resolves issue of loading previous, cached images; Converting image URLs to images in application slows down process of scrolling thru damage items of UI Table View: However - now images are available for each condition report;  (void)loadDamageItemImage:(NSString *)vin imageURL:(NSURL *)url { NSURL *damageImage; damageImage = saveImageDI; NSData *data = [NSData dataWithContentsOfURL:damageImage]; UIImage *image = [UIImage imageWithData:data]; if (image) { [self setImage:image]; [self alertFinishedLoadingImage:image]; return; } }
Topic: UI Frameworks SubTopic: UIKit Tags:
Mar ’21