Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Following code is use for the zooming par as the distance of the pin.</p> <pre><code>-(void) centerMap { MKCoordinateRegion region; CLLocationDegrees maxLat = -90; CLLocationDegrees maxLon = -180; CLLocationDegrees minLat = 120; CLLocationDegrees minLon = 150; NSArray *temp=self.AS; // NSArray *temp=[NSArray arrayWithArray:[NSArray arrayWithArray:[reports objectAtIndex:0]]]; for (int i=0; i&lt;[temp count];i++) { Place* home = [[[Place alloc] init] autorelease]; home.latitude = [[[temp objectAtIndex:i] valueForKey:@"latitude"]floatValue]; home.longitude =[[[temp objectAtIndex:i] valueForKey:@"longitude"]floatValue]; PlaceMark* from = [[[PlaceMark alloc] initWithPlace:home] autorelease]; CLLocation* currentLocation = (CLLocation*)from ; if(currentLocation.coordinate.latitude &gt; maxLat) maxLat = currentLocation.coordinate.latitude; if(currentLocation.coordinate.latitude &lt; minLat) minLat = currentLocation.coordinate.latitude; if(currentLocation.coordinate.longitude &gt; maxLon) maxLon = currentLocation.coordinate.longitude; if(currentLocation.coordinate.longitude &lt; minLon) minLon = currentLocation.coordinate.longitude; region.center.latitude = (maxLat + minLat) / 2; region.center.longitude = (maxLon + minLon) / 2; region.span.latitudeDelta = maxLat - minLat; region.span.longitudeDelta = maxLon - minLon; } [mapView setRegion:region animated:YES]; } - (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id &lt;MKAnnotation&gt;)annotation { if (annotation == mapView.userLocation) return nil; MKPinAnnotationView *pin = (MKPinAnnotationView *) [mapView dequeueReusableAnnotationViewWithIdentifier: @"asdf"]; if (pin == nil) pin = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier: @"asdf"] autorelease]; else pin.annotation = annotation; pin.userInteractionEnabled = YES; UIButton *disclosureButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; [disclosureButton setFrame:CGRectMake(0, 0, 30, 30)]; pin.rightCalloutAccessoryView = disclosureButton; pin.pinColor = MKPinAnnotationColorRed; //pin.animatesDrop = YES; [pin setEnabled:YES]; [pin setCanShowCallout:YES]; return pin; } </code></pre> <p>This code may help to create new application,</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload