- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation {
if (startingPoint == nil)
self.startingPoint = newLocation
CLLocationDistance distance = [newLocation
getDistanceFrom:startingPoint];
NSString *distanceString = [[NSString alloc]
initWithFormat:@"%.2f Miles", totalDistance *0.000621371];
DistanceTotal.text = distanceString;
}
@end
我正在爲我的應用程序製作距離計算器。當我運行應用程序時,沒有距離信息的文本框是空白的。你能幫我找到問題嗎? (文本字段被稱爲DistanceTotal)謝謝:)位置管理器的換位距離
犯錯,如果你開始回到起點,那麼你減少到那個位置的距離?我錯過了什麼嗎? – trojanfoe
@casperOne我已經編輯我的問題,以滿足堆棧溢出問題的要求... –