J'ai des problèmes de mémoire avec CLLocation.Problèmes de mémoire CLLocation
CLLocation *annotation = [[CLLocation alloc] initWithLatitude:[[tempDict objectForKey:@"lat"] doubleValue] longitude:[[tempDict objectForKey:@"lon"]doubleValue]];
CLLocation *item2 = [[CLLocation alloc] initWithLatitude:[newLatString doubleValue] longitude:[newLongString doubleValue]];
cell.detailTextLabel.text = [NSString stringWithFormat:@"%.1f km",[item2 distanceFromLocation:annotation]/1000];
[annotation release];
[item2 release];
J'ai donc essayé de le faire, mais j'ai réalisé que vous ne pouvez pas définir les coordonnées de l'annotation.
CLLocationCoordinate2D tempCoordinate = annotation.coordinate;
tempCoordinate.latitude = [[tempDict objectForKey:@"lat"] doubleValue];
tempCoordinate.longitude = [[tempDict objectForKey:@"lon"] doubleValue];
annotation.coordinate = tempCoordinate;
Y at-il une solution de contournement? Je ne veux pas être alloc/Initing un à chaque fois de CLLocation cellForRowAtIndexPath est appelé ..
Je fais des CLLocations pour que je puisse obtenir la distanceFromLocation. Fondamentalement, je fais un UITableView avec les magasins et leurs distances de mon emplacement actuel. –