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

  • Home
  • SEARCH
  • 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 4624344
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:07:00+00:00 2026-05-22T03:07:00+00:00

I am coding multiple annotations into a project. Currently I have 30 annotations, and

  • 0

I am coding multiple annotations into a project. Currently I have 30 annotations, and growing. I’m wondering if there is a simplier way of having to create a annotation.h and annotation.m classes for each single annotation.

Currently in my map view controller, I create the annotation objects and place them in an array, which has been working well for me but as you could imagine, its a lot of code to manage once you have tons of annotations, not to mention tons of classes.

So for example, one of the annotation classes looks like this:

Annotation.h:

//Annotation.h

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

@interface Annotation : NSObject {

}

@end

Annotation.m:

//Annotation.m

#import "Annotation.h"

@implementation Annotation

-(CLLocationCoordinate2D)coordinate;
{
    CLLocationCoordinate2D theCoordinate;
    theCoordinate.latitude = -45.866416;
    theCoordinate.longitude = 170.519931;
    return theCoordinate; 
}

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

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

-(void)dealloc
{
    [super dealloc];
}

@end

I’m thinking of reading in a CSV file with all the annotations would be the best way to go, any option I choose will result in me rewriting a lot of code, which is why I’m asking this question before I do anything. Does anyone have any suggestions?

  • 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-22T03:07:00+00:00Added an answer on May 22, 2026 at 3:07 am

    The MapCallouts sample app unfortunately doesn’t give a good example of how to implement a generic annotation class.

    Your class that implements the MKAnnotation protocol can provide a settable coordinate property or a custom init method that takes the coordinates.

    However, since you’re using iOS 4.0, an easier option is to just use the pre-defined MKPointAnnotation class that provides properties that you can set. For example:

    MKPointAnnotation *annot = [[MKPointAnnotation alloc] init];
    annot.title = @"Title";
    annot.subtitle = @"Subtitle";
    annot.coordinate = CLLocationCoordinate2DMake(-45.866416, 170.519931);
    [mapView addAnnotation:annot];
    [annot release];
    

    The annotation data can of course come from anywhere and you can loop through the data to create the annotations on the map.

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

Sidebar

Related Questions

I'm coding an MFC application in which i have a dialog box with multiple
I'm currently coding a product which will have only one database but will host
I am new to C++ coding. I have noticed that if I enter multiple
I'm currently planning (and part coding) a new app. I have an array of
Is there any way possible short of hand-coding the Reference.cs file, to get Visual
I'd like to have one coding style across multiple languages. Can anyone provide a
Hi there men of the coding realm. Im trying to add the 'multiple' attribute(?)
Is there any way that I can pass multiple variables to a view so
Coding footer naively, if there's not enough content, then there will be empty space
I'm a coding a JavaScript reporting component, that requires multiple LI's i.e. lists to

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.