Umístěním modrou tečku v mapKit s požadovaným umístěním

hlasů
2

Pro demonstrační účely, třeba i simulovat polohu uživatele v pohledu Mapkit. Zdá se, že je možné s nezdokumentovaný API umístit na modrou tečku kdekoliv na zobrazení mapy. Bohužel, já nevím, čarodějnice neregulérní API používat? Nějaká pomoc ?

Položena 11/05/2010 v 08:36
zdroj uživatelem
V jiných jazycích...                            


2 odpovědí

hlasů
0

Nejste si jisti, že je možné nastavit polohu uživatele CUSTOM (obvykle lidé používají obraz simulující modré uživatelské bod). Ačkoli nejsem 100% jistý, takže budete mít možnost vyzkoušet si něco takového zjistit, jestli je možné řešit userLocation jako u MKAnnotation ...

CLLocationCoordinate2D c = self.mapView.userLocation.location.coordinate;
[[self.mapView userLocation] setCoordinate:c];
Odpovězeno 03/12/2011 v 02:00
zdroj uživatelem

hlasů
0

Jste to nastavit?

mapView.showsUserLocation = YES;

Nastavení konkrétní místo, je to trochu složitější, ale určitě do-moci, aniž by nedokumentované API. Viz níže uvedený kód:

- (void)animateToSelectedPlace:(CGFloat)zoomLevel {
    MKCoordinateRegion region;
    region.center = [self getCoordinateFromComponents:chosenLatitude:chosenLongitude];

    MKCoordinateSpan span = {zoomLevel,zoomLevel};
    region.span = span;

    [mapView setRegion:region animated:YES];
}

-(CLLocationCoordinate2D)getCoordinateFromComponents:(NSNumber*)latitude:(NSNumber*)longitude {
    CLLocationCoordinate2D coord;
    coord.latitude = latitude.doubleValue;
    coord.longitude = longitude.doubleValue;
    return coord;
}
Odpovězeno 11/05/2010 v 08:43
zdroj uživatelem

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more