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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:23:44+00:00 2026-06-02T07:23:44+00:00

I´m creating a view with a Map and an annotation using the following class:

  • 0

I´m creating a view with a Map and an annotation using the following class:

#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>

@interface ContactDetailAnnotation : NSObject <MKAnnotation>

- (id) initWithLatitude:(CLLocationDegrees) lat longitude:(CLLocationDegrees) lng;
- (id) initWithCoordinate:(CLLocationCoordinate2D) coordinateArg;

@property (unsafe_unretained) CLLocationDegrees latitude;
@property (unsafe_unretained) CLLocationDegrees longitude;
@property (unsafe_unretained, nonatomic) CLLocationCoordinate2D coordinate;

@end

The problem is that the method:

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

used to draw my Point isn´t being trigered.
If i use

self.myMap.showsUserLocation = TRUE;    

The method is trigered, so the problem must be in the class i created.

My .m

#import "ContactDetailAnnotation.h"

@implementation ContactDetailAnnotation

@synthesize latitude = _latitude, longitude = _longitude, coordinate = _coordinate;

- (id) initWithCoordinate:(CLLocationCoordinate2D) coordinateArg
{
    self.coordinate = coordinateArg;

    return self;
}

- (id) initWithLatitude:(CLLocationDegrees)lat longitude:(CLLocationDegrees)lng 
{
    self.latitude = lat;
    self.longitude = lng;

    return self;
}

- (CLLocationCoordinate2D) coordinate 
{
CLLocationCoordinate2D coord = {self.latitude, 
                                self.longitude};
return coord;
}

@end
  • 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-02T07:23:46+00:00Added an answer on June 2, 2026 at 7:23 am

    Did you add your annotation to the mapview’s annotations array?

    Edit

    Here’s a bare-bones implementation that is working for me:

    MyAnnotation.h:

    #import <Foundation/Foundation.h>
    #import <Mapkit/Mapkit.h>
    
    @interface MyAnnotation : NSObject <MKAnnotation>
    {
        CLLocationCoordinate2D coordinate;
    }
    
    @property (nonatomic) CLLocationCoordinate2D coordinate;
    
    - (id) initWithCoordinate:(CLLocationCoordinate2D)aCoordinate;
    
    @end
    

    MyAnnotation.m

    #import "MyAnnotation.h"
    
    @implementation MyAnnotation
    
    @synthesize coordinate;
    
    - (id) initWithCoordinate:(CLLocationCoordinate2D)aCoordinate
    {
        coordinate = aCoordinate;
        return self;
    }
    
    @end
    

    My View Controller:

    - (void)viewDidLoad
    {
        [super viewDidLoad];
    
        CLLocationCoordinate2D coordinate = {42.149,-74.9384};
        MyAnnotation *myAnnotation = [[MyAnnotation alloc] initWithCoordinate:coordinate];
        [self.mapView addAnnotation:myAnnotation];
    }
    
    - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id < MKAnnotation >)annotation
    {
        MKAnnotationView *annotationView = [self.mapView dequeueReusableAnnotationViewWithIdentifier:@"Identifier"];
        if (annotationView == nil) {
            annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"Identifier"];
        }
        return annotationView;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any possibility of creating a view like the following image? I do
I'm creating an autolayout-friendly split view class for one of my applications. Among its
I'm creating a website where on the contacts page, the map view (map_canvas div)
I am creating list of <span class=infa9span><img src=/csm/view/include/images/foldericon.png/><a id=infa9Service>'+servicename+'</a><br/></span> tags dynamically and appending it
I am a new android developer. I am creating a map view application Where
I am creating an application which displays map using MKMapView control. I have a
I'm creating a custom Google map that plots multiple markers. View the link as
I'm creating a view of isometric tiles using this simple nested loop: const TILE_WIDTH:Number
I am creating view models for each screen in my ASP.NET MVC application. I
When creating a view and setting group by value some field, it groups only

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.