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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:40:16+00:00 2026-05-18T02:40:16+00:00

I am able to get a map to show up and a pin to

  • 0

I am able to get a map to show up and a pin to drop where I want in my iphone app project, but I want the title and subtitle to appear when the view loads. Here is the code I’m using. I thought putting in
[mapView selectAnnotation:annotation animated:YES];

would work, but it doesn’t. Does anyone know how to do this?

Thanks

CLLocationCoordinate2D coord = {latitude: 32.02008, longitude: -108.479707};

    [self.view addSubview:mapView];


MapController *annotation = [[MapController alloc]  initWithCoordinate:coord];
annotation.currentPoint = [NSNumber numberWithInt:1];
annotation.mTitle = @"MyTitle";
annotation.mSubTitle = @"My Address";
[mapView selectAnnotation:annotation animated:YES];
[mapView addAnnotation:annotation];
[annotation release];
  • 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-18T02:40:16+00:00Added an answer on May 18, 2026 at 2:40 am

    Calling selectAnnotation before it’s added to the map won’t work and even putting it after the addAnnotation line will not work because the annotation view hasn’t been drawn on the map yet.

    You’ll need to use the didAddAnnotationViews delegate method which is called when annotations are ready to manipulate:

    - (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views
    {
        id<MKAnnotation> myAnnotation = [mapView.annotations objectAtIndex:0];
        [mapView selectAnnotation:myAnnotation animated:YES];
    }
    

    The example just assumes you have one annotation and gets it from the mapView’s annotations array. You could also hold a reference to your annotation with an ivar.

    Make sure you have set the mapView’s delegate property otherwise the method won’t be called.

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

Sidebar

Related Questions

I want to be able to show a map of an area, and allow
I have a map view in my application and I am able to show
I am developing code for the map view in iphone where I was able
I am able to get the current date, but I don't know how to
I searched a lot in google but not able to get the answer required.
Ok, so am able to get the JSON from the PHP page, but when
not able to get this, can someone help for this LINQ query? select col1,
I am not able to get the hg head or status for a given
I am able to get the output of a pdf using fpdf, the problem
I'm not able to get this persistence file correct... I do not find any

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.