Mümkün mü?Resim ekle MKPointAnnotation'a ekle
Burada bana bir iğne veren bir eylem gerçekleştiriyorum. Ama bir görüntüye ihtiyacım var. Ve MKAnnotation benim için karmaşık görünüyor.
- (void)abreMapa:(NSString *)endereco {
NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&output=csv",
[endereco stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString]];
NSArray *listItems = [locationString componentsSeparatedByString:@","];
double latitude = 0.0;
double longitude = 0.0;
if([listItems count] >= 4 && [[listItems objectAtIndex:0] isEqualToString:@"200"]) {
latitude = [[listItems objectAtIndex:2] doubleValue];
longitude = [[listItems objectAtIndex:3] doubleValue];
}
else {
//Show error
}
CLLocationCoordinate2D coordinate;
coordinate.latitude = latitude;
coordinate.longitude = longitude;
myMap.region = MKCoordinateRegionMakeWithDistance(coordinate, 2000, 2000);
MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init];
[annotation setCoordinate:coordinate];
[annotation setTitle:@"Some Title"];
[myMap addAnnotation:annotation];
// Coloca o icone
[self.view addSubview:mapa];
}
Teşekkürler!
Bu MKMapViewDelegate benim için görünmüyor. –
http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MKMapViewDelegate_Protocol/MKMapViewDelegate/MKMapViewDelegate.html. Muhtemelen MKMapView'ün temsilci özelliğini onu yöneten denetleyiciye ayarlayacaksınız. –
Bu basit uygulamayı nasıl uygulayabileceğimi gösterebilen basit bir örnek dosya var mı? –