我有一個應用程序,我必須檢查用戶的移動位置是否已更改或連續30秒?如果它在30秒內沒有改變,則用戶將被導航到另一個視圖,如果它已經改變,那麼用戶將會在30秒內收到一條消息,表明您的移動位置的座標發生了變化。Iphone核心位置
我在這裏使用這些代碼,但它什麼也不做......
-(void)time
{
for(int i = 0; i<= timeremaining ;i++)
{
if (new1 == old)
{
if(timeremaining == 1)
{
Timer90 *timerview = [[Timer90 alloc] initWithNibName:@"Timer90" bundle:nil];
[self.navigationController pushViewController:timerview animated:YES];
}
}
else
{
[NSTimer cancelPreviousPerformRequestsWithTarget:self selector:@selector(time) object:nil];
}
timeleft.text = [NSString stringWithFormat:@"%d",timeremaining];
}
timeremaining--;
}
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
new1 = newLocation;
old=oldLocation;
latitude = [[NSString alloc]initWithFormat:@"%g",newLocation.coordinate.latitude];
longitude = [[NSString alloc]initWithFormat:@"%g",newLocation.coordinate.longitude];
accuracy = [[NSString alloc] initWithFormat:@"%g",newLocation.horizontalAccuracy];
if(oldLocation == NULL)
{
oldLocation == newLocation;
}
}
timer90是我view.Please幫助我的朋友的名字...任何幫助將不勝感激。
WD對distanceFromLocation的評論也是明智的,而不是我的確切比較 – 2011-04-18 14:24:35