I have 30 annotations and are growing. Looking for an easier way to encode this?

I am coding a few annotations into a project. I currently have 30 annotations and are growing. I am wondering if there is an easier way to create the annotation.h and annotation.m classes for each individual annotation.

Currently, in my map view controller, I create annotation objects and place them in an array that works well for me, but as you could imagine, there is a lot of code to manage it when you have tons of annotations, not to specify tons 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

CSV , , , , , , , -. - ?

+3
2

MapCallouts, , , .

, MKAnnotation, coordinate , .

, iOS 4.0, MKPointAnnotation, . :

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

, , , .

+3

, (lat, lon, title, subtitle) plist?

, , sqlite db?

, ? Mapview

+2

All Articles