पर एक छवि जोड़ें क्या यह संभव है?MKPointAnotation
मैं यहां एक क्रिया कर रहा हूं जो मुझे एक पिन देता है। लेकिन मुझे एक छवि चाहिए। और एमकेएनोटेशन मेरे लिए जटिल लगता है।
- (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];
}
धन्यवाद!
यह MKMapViewDelegate मेरे लिए प्रकट नहीं होता है। –
http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MKMapViewDelegate_Protocol/MKMapViewDelegate/MKMapViewDelegate.html। आप शायद एमकेमैप व्यू की प्रतिनिधि संपत्ति को इसे प्रबंधित नियंत्रक को सेट करेंगे। –
क्या कोई नमूना फ़ाइल है, सरल, एप्पल नहीं, जो मुझे दिखा सकता है कि इस सरल को कैसे कार्यान्वित किया जाए? –