Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7996149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:38:02+00:00 2026-06-04T14:38:02+00:00

I have between 2-10 annotations pins on the map. When I click a button,

  • 0

I have between 2-10 annotations pins on the map. When I click a button, I would like the map to zoom out and center so the user can see all the pins. How can I do this?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:38:05+00:00Added an answer on June 4, 2026 at 2:38 pm

    Assuming you have an array of all your annotations you could do the following:

    CLLocationCoordinate2D leftTop = CLLocationCoordinate2DMake(-90,180);
    CLLocationCoordinate2D rightBottom = CLLocationCoordinate2DMake(90, -180);
    
    for (int i=0; i < [annotations count]; i++) {
        id<MKAnnotation> annotation = (id<MKAnnotation>)[annotation objectAtIndex:i];
        CLLocationCoordinate2D coord = annotation.coordinate;
        if (coord.latitude > leftTop.latitude) {
            leftTop.latitude = coord.latitude;
        }
        if (coord.longitude < leftTop.longitude) {
            leftTop.longitude = coord.longitude;
        }
        if (coord.latitude < rightBottom.latitude) {
            rightBottom.latitude = coord.latitude;
        }
        if (coord.longitude > rightBottom.longitude) {
            rightBottom.longitude = coord.longitude;
        }
    }
    
    MKCoordinateSpan regSpan = MKCoordinateSpanMake(leftTop.latitude-rightBottom.latitude, rightBottom.longitude-leftTop.longitude);
    CLLocationCoordinate2D center = CLLocationCoordinate2DMake(leftTop.latitude-regSpan.latitudeDelta/2, leftTop.longitude+regSpan.longitudeDelta/2);
    regSpan.latitudeDelta = MAX(regSpan.latitudeDelta, 0.01);
    regSpan.longitudeDelta = MAX(regSpan.longitudeDelta, 0.01);
    MKCoordinateRegion reg = MKCoordinateRegionMake(center, regSpan);
    if (CLLocationCoordinate2DIsValid(center)) {
        [_mapView setRegion:reg animated:YES];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My stackpanels have gaps between each item (TextBlocks). You can see through to whatever
I would like to have colored vbars between my links. What is the best
I have an existing data model. I would like to express this data model
I want to create @ManyToOne mapping between Acount and Record. One account can have
Does one necessarily have to make a strict choice between using annotations and hibernate
I want to add annotations to a route between 2 locations on the map.
I have defined a many-to-many relationship between my two entity classes User and Permission.
I'm using Hibernate version 3.3.2.GA with annotations. I have inheritance between two classes, the
i have between 1 and 10 floating divs. If i'm showing 1-5 or all
In an application I will have between about 3000 and 30000 strings. After creation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.