5
Uber iOS
と同じ機能を実装しており、アニメーション付きのルートに従ってピンを移動します。iOS:移動ピンの吹き出しビューを表示
問題:移動中にピンをクリックすると、MKMapView
のdidSelectAnnotationView
代理人を取得できません。しかし、ピンが安定していれば、動かないことを意味します。
コード:更新
- (void)updateLocation {
CLLocationCoordinate2D oldLocation;
CLLocationCoordinate2D newLocation;
oldLocation.latitude = [self convertStringToFloat:self.arrayCSV[self.index-1][@"Latitude"]];
oldLocation.longitude = [self convertStringToFloat:self.arrayCSV[self.index-1][@"Longitude"]];
newLocation.latitude = [self convertStringToFloat:self.arrayCSV[self.index][@"Latitude"]];
newLocation.longitude = [self convertStringToFloat:self.arrayCSV[self.index][@"Longitude"]];
float getAngle = [self angleFromCoordinate:oldLocation toCoordinate:newLocation];
CLLocation *oldInfo = [[CLLocation alloc] initWithLatitude:oldLocation.latitude longitude:oldLocation.longitude];
CLLocation *newInfo = [[CLLocation alloc] initWithLatitude:newLocation.latitude longitude:newLocation.longitude];
[UIView animateWithDuration:3
animations:^{
myAnnotation.coordinate = newLocation;
AnnotationView *annotationView = (AnnotationView *)[self.mapView viewForAnnotation:myAnnotation];
annotationView.transform = CGAffineTransformMakeRotation(getAngle);
}];
}
あなたは私の一日の感謝の@wolverineを保存していました。 –