मैं करने के लिए uncenter मानचित्र दृश्य कोशिश कर रहा हूँ और सभी एनोटेशन बाहर निकालना। इस का कारण यह है कि MapView अलग एनोटेशन और स्थानों को प्रदर्शित करने के लिए अलग दृष्टिकोण नियंत्रकों द्वारा उपयोग किया जाएगा है। क्या अब हो रहा है कि मैं एनोटेशन बाहर निकालना विधि का उपयोग कर रहा है और मैं उन्हें निकालता है, लेकिन नक्शे मौके पर ही केंद्रित रहता है और इस तरह जब नई व्याख्याएं में आते हैं, इसे स्थानांतरित नहीं करता है। वहाँ क्षेत्र पुनर्स्थापित करने के लिए और यदि हां, तो क्या मूल्य कर मैं इसे करने के लिए रीसेट एक रास्ता है। मैं शून्य, शून्य करने की कोशिश की और कुछ गणना मूल्य लेकिन मूल एनीमेशन कहते हैं वे सब अमान्य हैं। मैं कैसे है कि बाहर ज़ूम और मेरी नई व्याख्याएं पर में वापस करने के लिए मिलता है?
यहाँ कुछ कोड है
-(void)recenterMap {
NSArray *coordinates = [_mapView valueForKeyPath:@annotations.coordinate];
CLLocationCoordinate2D maxCoord = {-90.0f, -180.0f};
CLLocationCoordinate2D minCoord = {90.0f, 180.0f};
//NSLog(@%@, [coordinates description]);
for (NSValue *value in coordinates) {
CLLocationCoordinate2D coord = {0.0f, 0.0f};
[value getValue: &coord];
if(coord.longitude > maxCoord.longitude) {
maxCoord.longitude = coord.longitude;
}
if(coord.latitude > maxCoord.latitude){
maxCoord.latitude = coord.latitude;
}
if(coord.longitude < minCoord.longitude){
minCoord.longitude = coord.longitude;
}
if(coord.latitude < minCoord.latitude){
minCoord.latitude = coord.latitude;
}
}
MKCoordinateRegion region = {{0.0f, 0.0f}, {0.0f, 0.0f}};
region.center.longitude = (minCoord.longitude + maxCoord.longitude) / 2.0;
region.center.latitude = (minCoord.latitude + maxCoord.latitude) / 2.0;
region.span.longitudeDelta = maxCoord.longitude - minCoord.longitude;
region.span.latitudeDelta = maxCoord.latitude - minCoord.latitude;
[_mapView setRegion: region animated: YES];
}
recenter methos Thats मैं उपयोग कर रहा हूँ
- (MKAnnotationView *)mapView: (MKMapView *)mapView viewForAnnotation: (id <MKAnnotation>)annotation{
MKAnnotationView *view = nil;
if(annotation != mapView.userLocation){
Annotation *schoolAnn = (Annotation*)annotation;
view = [self.mapView dequeueReusableAnnotationViewWithIdentifier:@schoolLoc];
if(nil == view){
view = [[[MKPinAnnotationView alloc] initWithAnnotation:schoolAnn reuseIdentifier:@schoolLoc]autorelease];
}
[(MKPinAnnotationView *)view setAnimatesDrop:YES];
[view setCanShowCallout:YES];
}
else {
[self recenterMap];
}
return view;
}
जब तक नीले संगमरमर चला जाता है में तो नक्शा recenters यह और टुकड़ा इंतजार कर रहा है। समस्या मैं उस भाग के साथ किया है कि जब मैं पिछले देखें नियंत्रक के लिए वापस जाओ मैं सभी एनोटेशन बाहर निकालना है, इसलिए जब मैं (किसी कारण से) उपयोगकर्ता स्थान में वापस आने में वापस पॉप नहीं करता है। कैसे मैं इस पॉप करने के लिए मिलता है पीठ में?
अग्रिम लोगों में धन्यवाद













