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 6922425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:24:16+00:00 2026-05-27T10:24:16+00:00

Sure this is something simple as I’m just starting with the maps. I already

  • 0

Sure this is something simple as I’m just starting with the maps. I already have a map showing one location, but when I’ve added a second anotation the map stays zoomed all the way out rather than going to my locations. The pins are there when I zoom in, so I know that bit’s working.

Code snippets:

- (void)viewDidLoad
{
...
...
...

// Set coordinates for our position
CLLocationCoordinate2D location;
location.latitude = [self.lat doubleValue];
location.longitude = [self.lon doubleValue];

// Add the annotation to our map view
MapViewAnnotation *newAnnotation = [[MapViewAnnotation alloc] 
                                    initWithTitle:self.placename                                        
                                    andSubtitle:self.subtitle
                                    andCoordinate:location];
[self.mapView addAnnotation:newAnnotation];
[newAnnotation release];

// Set coordinates for our second position
CLLocationCoordinate2D amenitylocation;
amenitylocation.latitude = self.latitude;
amenitylocation.longitude = self.longitude;

// Add the annotation to our map view
MapViewAnnotation *amenityAnnotation = [[MapViewAnnotation alloc] 
                                    initWithTitle:self.callouttitle                                        
                                    andSubtitle:self.calloutsubtitle
                                    andCoordinate:amenitylocation];
[self.mapView addAnnotation:amenityAnnotation];
[amenityAnnotation release];

[super viewDidLoad];

}



#pragma mark - MKMapView Delegates

// When a map annotation point is added, zoom to it (1500 range)
- (void)mapView:(MKMapView *)mv didAddAnnotationViews:(NSArray *)views
{
MKAnnotationView *annotationView = [views objectAtIndex:0];
id <MKAnnotation> mp = [annotationView annotation];
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance([mp coordinate], 1500, 1500);
[mv setRegion:region animated:YES];
[mv selectAnnotation:mp animated:YES];
}

- (MKAnnotationView *)mapView:(MKMapView *)mv viewForAnnotation:(id<MKAnnotation>)annotation
{
if(mapView.userLocation==annotation)
{
    return nil;
}

NSString *identifier = @"IDENTIFIER";

MKPinAnnotationView *annotationView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:identifier];

if(annotationView==nil)
{
    annotationView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier]autorelease];
    annotationView.pinColor=MKPinAnnotationColorPurple;
    annotationView.canShowCallout=YES;
}

return annotationView;
}

I’d appreciate any pointers.

Also, am I right in thinking I’ll have to make custom callouts if I want more than one to appear on the map at the same time?

  • 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-05-27T10:24:17+00:00Added an answer on May 27, 2026 at 10:24 am

    Sorry, found the answer – I didn’t have the MKMapView delegate linked to File’s Owner in IB, although I do have in my header file. Linked that up and it’s working.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am sure I am just missing something. But I have googled this for
I'm sure this is something simple but I am just not seeing it. My
I'm sure this is something simple but I've been staring at it for a
I am sure this is something really simple, but I am going bonkers trying
Not sure if I've just missed something but this doesn't work: $(this).children('td.threadtitle a').html('thread title');
I'm sure this must be something simple, but I can't quite work out what's
I'm sure this is something really simple that I'm overlooking, but MS SQL is
I'm sure this is something really simple, like a misplaced quote, but I'm completely
I'm sure this is something simple, but I can't seem to figure it out.
I'm sure this is something very simple that I'm screwing up, but here goes:

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.