Benim MKMapView eklemek istediğiniz birkaç ek açıklamaları var (elinden n etrafında genelde 5'tir 0-n öğeler). Ben ince açıklamaları ekleyebilir, ama ekrandaki tek seferde ek açıklamaları sığdırmak için haritayı yeniden boyutlandırmak istiyorum, ve bunu nasıl emin değilim.
Ben baktığımız -regionThatFits:ama onunla ne yapacağını pek emin değilim. Ben bugüne kadar ne var göstermek için bazı kod göndeririz. Bunun genel olarak basit bir görev olması gerektiğini düşünüyorum ama şimdiye kadar MapKit ile biraz bunalmış hissediyorum.
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
location = newLocation.coordinate;
//One location is obtained.. just zoom to that location
MKCoordinateRegion region;
region.center = location;
//Set Zoom level using Span
MKCoordinateSpan span;
span.latitudeDelta = 0.015;
span.longitudeDelta = 0.015;
region.span = span;
// Set the region here... but I want this to be a dynamic size
// Obviously this should be set after I've added my annotations
[mapView setRegion:region animated:YES];
// Test data, using these as annotations for now
NSArray *arr = [NSArray arrayWithObjects:@one, @two, @three, @four, nil];
float ex = 0.01;
for (NSString *s in arr) {
JBAnnotation *placemark = [[JBAnnotation alloc] initWithLat:(location.latitude + ex) lon:location.longitude];
[mapView addAnnotation:placemark];
ex = ex + 0.005;
}
// What do I do here?
[mapView setRegion:[mapView regionThatFits:region] animated:YES];
}
Ben konum güncellemesi alır almaz Bildirimi, bu tüm bu bunu yapmak için uygun bir yer ise bilmiyorum ... olur. Değilse, nerede daha iyi bir yer olurdu? -viewDidLoad?
Şimdiden teşekkürler.













