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"];
它工作正常,除了我刚刚发现了一个问题,当你浏览其他页面的高度距离文本被复制过详细的文字标签的顶部。
这里是我的意思的屏幕截图。
任何想法为什么这样做?