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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:47:46+00:00 2026-06-01T05:47:46+00:00

I have already checked many questions in StackOverflow but none of them worked for

  • 0

I have already checked many questions in StackOverflow but none of them worked for me.

I am developing an iPad application. I created all interfaces in Storyboard.

For my project I created one view controller and corresponding .h .m files and linked them. Then I added MKMapView inside of the view controller then I referenced mapView in view controller file by using Interface Builder. I created bunch of points and showed them on map.

Everything was perfect until I decided to change pin colors. I followed MapCallout example from Apple Developer site. Then I Created custom annotation point class as you see below

CustomMKAnnotation.h file

@interface CustomMKAnnotation : NSObject <MKAnnotation>
{}

CustomMKAnnotation.m file

@implementation CustomMKAnnotation

- (NSString *)title {return @"title";}
- (NSString *)subtitle{return @"subtitle";}

- (CLLocationCoordinate2D)coordinate;{
    CLLocationCoordinate2D theCoordinate;
    theCoordinate.latitude = some latitude;
    theCoordinate.longitude = some longitude;
    return theCoordinate; 
}
@end

Here my viewcontroller class

MapHolderViewController.h file

@interface MapHolderViewController : UIViewController<MKMapViewDelegate>
{
    NSMutableArray *mapAnnotations;
}
@property (nonatomic,retain) IBOutlet MKMapView *myMap;
@property (nonatomic, retain)  NSMutableArray *mapAnnotations;

-(void) addLatLong;

@end

MapHolderViewController.m file

@implementation MapHolderViewController

@synthesize myMap;
@synthesize mapAnnotations;

-(void) addLatLong{
    // I am adding annotations here
}
- (MKAnnotationView *)myMap:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
    // This function has never been called.
}
@end

I referenced delegate outlet from MKMapView to ViewController. I also set myMap.delegate=self; in MapHolderViewController.m file but it didn’t work either.

Any insight is welcome.

  • 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-01T05:47:47+00:00Added an answer on June 1, 2026 at 5:47 am

    The problem seems to be that your delegate method is not named correctly.

    You have written the delegate method like this:

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

    So your method is myMap:viewForAnnotation:.

    The correct header is:

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

    The method name must be mapView:viewForAnnotation:.

    You can change the parameter names (the names after the parameter types) but not the parts in front of the parameter types which are part of the method name.

    For example, this would be OK:

    - (MKAnnotationView *)mapView:(MKMapView *)myMap 
        viewForAnnotation:(id < MKAnnotation >)annotation
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have already checked stackoverflow. Their Jquery/Javascript code is cryptic. The variables are all
I have already created a webpart to show the data from list, but I
I have already posted something similar here but I would like to ask the
I have already posted a question about this, but the situation has changed sufficiently
I already read many examples on extending ListViews with checkboxes bound with IsSelected. But
Hi I have a problem with my strings and I have already checked this
I've checked out a few of the stackoverflow questions and there are similar questions,
I'm really lost here. I already checked many answers to how to add something
I have this piece of Javascript and it just won't work. I allready checked
I have already searched about this issue, analyzed several open source tools (like Ganymed

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.