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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:00:44+00:00 2026-05-23T12:00:44+00:00

I am displaying a pin on the map but I am not able to

  • 0

I am displaying a pin on the map but I am not able to customize the display of the annotation view. For some reason my viewForAnnotation is not being called. Here is didFinishLaunchingWithOptions method.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [mapView setDelegate:self]; 

    locationManager = [[CLLocationManager alloc] init]; 
    [locationManager setDelegate:self];

    [locationManager setDistanceFilter:kCLDistanceFilterNone];
    [locationManager setDesiredAccuracy:kCLLocationAccuracyBest];

    [mapView setShowsUserLocation:YES];


    // Override point for customization after application launch.
    [self.window makeKeyAndVisible];
    return YES;


}

And here is my viewForAnnotation method which is never being called.

- (MKAnnotationView *)mv:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{

    NSLog(@"viewForAnnotation");

    if([annotation isKindOfClass:[MKUserLocation class]])
        return nil; 

    static NSString *annotationIdentifier = @"AnnotationIdentifier"; 
    MKPinAnnotationView *pinView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:annotationIdentifier];

    [pinView setPinColor:MKPinAnnotationColorGreen];
    pinView.animatesDrop = YES; 
    pinView.canShowCallout = YES; 

    UIImageView *houseIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"house.png"]];
    pinView.leftCalloutAccessoryView = houseIconView; 
    [houseIconView release]; 

    return pinView; 
}

and here is didUpdateUserLocation method:

- (void)mapView:(MKMapView *)mv didUpdateUserLocation:(MKUserLocation *)userLocation
{

    NSTimeInterval t = [[[userLocation location] timestamp] timeIntervalSinceNow];

    if(t < -180) return; 

    NSLog(@"%@",[textField text]);

    MapPoint *mp = [[MapPoint alloc] initWithCoordinate:userLocation.location.coordinate title:[textField text]];



    [mv addAnnotation:mp];
    [mp 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-23T12:00:45+00:00Added an answer on May 23, 2026 at 12:00 pm

    The viewForAnnotation delegate method must be named mapView:viewForAnnotation:.

    Your method is named mv:viewForAnnotation:.

    Edit:
    Here is an example with the two other changes suggested in my comments:

    - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
    {
        NSLog(@"viewForAnnotation");
    
        if([annotation isKindOfClass:[MKUserLocation class]])
            return nil; 
    
        static NSString *annotationIdentifier = @"AnnotationIdentifier"; 
    
        MKPinAnnotationView *pinView = (MKPinAnnotationView *) [mapView 
            dequeueReusableAnnotationViewWithIdentifier:annotationIdentifier];
    
        if (!pinView) 
        {
            pinView = [[[MKPinAnnotationView alloc] 
                initWithAnnotation:annotation 
                reuseIdentifier:annotationIdentifier] autorelease];
    
            [pinView setPinColor:MKPinAnnotationColorGreen];
            pinView.animatesDrop = YES; 
            pinView.canShowCallout = YES; 
    
            UIImageView *houseIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"house.png"]];
            pinView.leftCalloutAccessoryView = houseIconView; 
            [houseIconView release];        
        }
        else 
        {
            pinView.annotation = annotation;
        }
    
        return pinView; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an issue with a particular controller action not displaying the view. Here
i am using MKMapView Annotation for Displaying pin's.In my Project there are many number
For Displaying the street view in the map i am putting the following code:
I am displaying a fixed sequence in the tree list along with some values
I'm displaying a dynamic list of names in a table view, and I'm trying
Displaying a View inside a Region is about 5-10 seconds slow for the first
Displaying a rectangle and binding Width, Height, Angle to a view model class works
I want to use jQuery Thickbox for displaying my images but so far when
Displaying Spring Dropdown in JSP if user does NOT have value in it.. I
Displaying content’s based on category and tags criteria works well but how should we

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.