0
테이블의 위치 거리를 계산하는 uitableview를 만들었습니다. 나는이 코드를 인덱스 경로의 행에 대해 셀에 사용했다.uitableview에서 텍스트가 두 번 인쇄됩니다.
NSString *lat1 = [object valueForKey:@"Lat"];
NSLog(@"Current Spot Latitude:%@",lat1);
float lat2 = [lat1 floatValue];
NSLog(@"Current Spot Latitude Float:%g", lat2);
NSString *long1 = [object valueForKey:@"Lon"];
NSLog(@"Current Spot Longitude:%@",long1);
float long2 = [long1 floatValue];
NSLog(@"Current Spot Longitude Float:%g", long2);
//Getting current location from NSDictionary
CoreDataTestAppDelegate *appDelegate = (CoreDataTestAppDelegate *) [[UIApplication sharedApplication] delegate];
NSString *locLat = [NSString stringWithFormat:appDelegate.latitude];
float locLat2 = [locLat floatValue];
NSLog(@"Lat: %g",locLat2);
NSString *locLong = [NSString stringWithFormat:appDelegate.longitude];
float locLong2 = [locLong floatValue];
NSLog(@"Long: %g",locLong2);
//Location of selected spot
CLLocation *loc1 = [[CLLocation alloc] initWithLatitude:lat2 longitude:long2];
//Current Location
CLLocation *loc2 = [[CLLocation alloc] initWithLatitude:locLat2 longitude:locLong2];
double distance = [loc1 getDistanceFrom: loc2]/1600;
NSMutableString* converted = [NSMutableString stringWithFormat:@"%.1f", distance];
[converted appendString: @" m"];
그것은 당신이 페이지의 높이를 넘어 스크롤 할 때의 거리 텍스트가 자세한 텍스트 레이블의 맨 위에 중복 난 그냥 발견 한 문제에서 떨어져 잘 작동합니다.
여기에 제가 의미하는 스크린 샷이 있습니다.
이유는 무엇입니까?