我有一些CLLocation的内存问题。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];
所以我试图做到这一点,但我意识到你不能设置注释的坐标。
CLLocationCoordinate2D tempCoordinate = annotation.coordinate;
tempCoordinate.latitude = [[tempDict objectForKey:@"lat"] doubleValue];
tempCoordinate.longitude = [[tempDict objectForKey:@"lon"] doubleValue];
annotation.coordinate = tempCoordinate;
有没有解决方法呢?我并不想成为分配/ INITING一个CLLocation每次的cellForRowAtIndexPath被称为..
我在做CLLocations,所以我可以得到distanceFromLocation。基本上我正在制作一个UITableView,这些商店和他们距离我目前的位置的距离。 – 2010-09-28 03:42:55