ultima uber sesión registrarse puedo porque partner now funciona documentos conductor celular actualizacion abrir iphone ios objective-c mkmapview mkannotationview

iphone - sesión - uber.com drive



La animación del auto(anotación)(como la aplicación uber) no funciona (3)

Hice un proyecto de demostración (de Moving-MKAnnotationView demo en github) para mover un automóvil en el mapa, a continuación se muestra su enlace

https://github.com/pratikbhiyani/Moving-MKAnnotationView

Edito mi código en función de la respuesta dada por vinaut, pero el problema sigue siendo que cuando hacemos zoom o nos desplazamos, la animación del mapa se distrae en ios 7 y en ios 6 cuando hacemos zoom o desplazamos el conjunto de anotaciones del mapa a su ángulo original por un tiempo .

A continuación se muestra una captura de pantalla de mi proyecto de demostración

Aquí hay un código que cambio

- (void) setPosition : (id) posValue; { NSLog(@"set position"); //extract the mapPoint from this dummy (wrapper) CGPoint struct MKMapPoint mapPoint = *(MKMapPoint*)[(NSValue*)posValue pointerValue]; CLLocationCoordinate2D coord = MKCoordinateForMapPoint(mapPoint); CGPoint toPos; if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) { toPos = [self.mapView convertCoordinate:coord toPointToView:self.mapView]; } else { CGFloat zoomFactor = self.mapView.visibleMapRect.size.width / self.mapView.bounds.size.width; toPos.x = mapPoint.x/zoomFactor; toPos.y = mapPoint.y/zoomFactor; } [self setTransform:CGAffineTransformMakeRotation([self getHeadingForDirectionFromCoordinate:MKCoordinateForMapPoint(previousPoint) toCoordinate: MKCoordinateForMapPoint(mapPoint)])]; if (MKMapRectContainsPoint(self.mapView.visibleMapRect, mapPoint)) { CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"]; animation.fromValue = [NSValue valueWithCGPoint:self.center]; animation.toValue = [NSValue valueWithCGPoint:toPos]; animation.duration = 1.0; animation.delegate = self; animation.fillMode = kCAFillModeForwards; //[self.layer removeAllAnimations]; [self.layer addAnimation:animation forKey:POSITIONKEY]; //NSLog(@"setPosition ANIMATED %x from (%f, %f) to (%f, %f)", self, self.center.x, self.center.y, toPos.x, toPos.y); } self.center = toPos; previousPoint = mapPoint; }

Mi objetivo es mover el auto igual que en la aplicación súper.


El problema de distraer un automóvil mientras se acerca / desplaza el mapa. En realidad no se puede lograr agregando una animación a la anotación. Descubrí la función Interpolar a través de la cual puedo obtener las ubicaciones entre las coordenadas "De" y "Hasta" y establecerla en la anotación (establecer las coordenadas de la anotación en milisegundos) se verá como una animación.

No es un problema de iOS o Mapa, si está agregando animación a la anotación, se agregará a la capa de anotación no respetando el punto del mapa.


Parece que algo cambió con las funciones de conversión para CLCoordinate2D / MKMapPoint / CGPoint ...

La detección de un punto en un MKPolygon se rompió con iOS7 (CGPathContainsPoint)

La anotación desaparece porque la conversión entre MkMapPoints y CGIPoints ya no funciona, si registra la "posición" del CALayer obtendrá puntos fuera de la vista. No tengo idea de por qué funciona al hacer eventos táctiles.

Si cambias la función a:

- (void) setPosition : (id) posValue; { //extract the mapPoint from this dummy (wrapper) CGPoint struct MKMapPoint mapPoint = *(MKMapPoint*)[(NSValue*)posValue pointerValue]; CLLocationCoordinate2D coord = MKCoordinateForMapPoint(mapPoint); CGPoint toPos = [self.mapView convertCoordinate:coord toPointToView:self.mapView]; if (MKMapRectContainsPoint(self.mapView.visibleMapRect, mapPoint)) { CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"]; animation.fromValue = [NSValue valueWithCGPoint:self.center]; animation.toValue = [NSValue valueWithCGPoint:toPos]; animation.duration = 0.8; animation.delegate = self; animation.fillMode = kCAFillModeForwards; //[self.layer removeAllAnimations]; [self.layer addAnimation:animation forKey:POSITIONKEY]; //NSLog(@"setPosition ANIMATED %x from (%f, %f) to (%f, %f)", self, self.center.x, self.center.y, toPos.x, toPos.y); } self.center = toPos; }

Debería estar funcionando de nuevo.


Soy el colaborador original de Moving-MKAnnotationView ( https://github.com/100grams/Moving-MKAnnotationView.git ). Este componente se escribió originalmente con iOS4.3 y muchas cosas han cambiado desde entonces. :-)

La causa principal aquí fue la conversión de MKMapPoint a CGPoint (coordenadas de pantalla). Aunque el código funcionó antes, se rompe en iOS7 y lo arreglé utilizando esto para convertir la coordenada lat / lon en coordenadas de pantalla:

convertCoordinate:toPointToView:

He comprometido esta solución, con algunas otras actualizaciones, a https://github.com/100grams/Moving-MKAnnotationView.git por lo que ahora funciona en iOS7 / Xcode5.