timer1= [NSTimer scheduledTimerWithTimeInterval:1.0
target:self selector:@selector(onTick:)
userInfo:nil repeats:YES];
for (int i=0; i<=ad.trackHistoryLatitude.count-1; i++) {
latitudeStr =[ad.trackHistoryLatitude objectAtIndex:i];
// for (int j=0; j<=ad.trackHistoryLatitude.count; j++) {
longitudeStr =[ad.trackHistoryLongitude objectAtIndex:i];
MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude = latitudeStr.floatValue ;
region.center.longitude = longitudeStr.floatValue;
region.span.longitudeDelta = 0.10f;
region.span.latitudeDelta = 0.10f;
[self.playbackMapView setRegion:region animated:YES];
}
-(void)onTick:(NSTimer *)timer {
if (j >=ad.trackHistoryLatitude.count-1) {
[timer1 invalidate];
}else{
latitudeStr =[ad.trackHistoryLatitude objectAtIndex:j++];
longitudeStr =[ad.trackHistoryLongitude objectAtIndex:k++];
CLLocationCoordinate2D myCoordinate;
MKPointAnnotation* annotation = [[MKPointAnnotation alloc] init];
myCoordinate.latitude=latitudeStr.floatValue;
annotation.title=@"car";
myCoordinate.longitude=longitudeStr.floatValue;
annotation.coordinate = myCoordinate;
[self.playbackMapView removeAnnotation:[self.playbackMapView.annotations lastObject]];
[self.playbackMapView addAnnotation:annotation];
}
}
target:self selector:@selector(onTick:)
userInfo:nil repeats:YES];
for (int i=0; i<=ad.trackHistoryLatitude.count-1; i++) {
latitudeStr =[ad.trackHistoryLatitude objectAtIndex:i];
// for (int j=0; j<=ad.trackHistoryLatitude.count; j++) {
longitudeStr =[ad.trackHistoryLongitude objectAtIndex:i];
MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude = latitudeStr.floatValue ;
region.center.longitude = longitudeStr.floatValue;
region.span.longitudeDelta = 0.10f;
region.span.latitudeDelta = 0.10f;
[self.playbackMapView setRegion:region animated:YES];
}
-(void)onTick:(NSTimer *)timer {
if (j >=ad.trackHistoryLatitude.count-1) {
[timer1 invalidate];
}else{
latitudeStr =[ad.trackHistoryLatitude objectAtIndex:j++];
longitudeStr =[ad.trackHistoryLongitude objectAtIndex:k++];
CLLocationCoordinate2D myCoordinate;
MKPointAnnotation* annotation = [[MKPointAnnotation alloc] init];
myCoordinate.latitude=latitudeStr.floatValue;
annotation.title=@"car";
myCoordinate.longitude=longitudeStr.floatValue;
annotation.coordinate = myCoordinate;
[self.playbackMapView removeAnnotation:[self.playbackMapView.annotations lastObject]];
[self.playbackMapView addAnnotation:annotation];
}
}
Sign up here with your email
ConversionConversion EmoticonEmoticon