Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

macprogrammer80

macrumors newbie
Original poster
Apr 22, 2009
15
0
OK, I'm sure I'm missing something fundamental here, but here's what I want to do - I have about 10 pins all on the screen at once. As you would expect, when you tap on a pin to get the callout/bubble, I want each pin to have different text within it. I'm using the following code:

To draw the pin:


Code:
AddressAnnotation *showRedFlag;

redFlag.latitude = -33.840786;
redFlag.longitude = 151.205338;
showRedFlag = [[AddressAnnotation alloc] initWithCoordinate:redFlag];

[mapView addAnnotation:showRedFlag];


And the .h file for AddressAnnotation:

Code:
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <MapKit/MKAnnotation.h>

@interface AddressAnnotation : NSObject<MKAnnotation> 
{
     CLLocationCoordinate2Dcoordinate;
     NSString *returnResult;
     NSString *mTitle;
     NSString *mSubTitle;
}

@end


And the .m file for AddressAnnotation:

Code:
@implementation AddressAnnotation

@synthesize coordinate;

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

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

-(id)initWithCoordinate:(CLLocationCoordinate2D) c
{
     coordinate=c;
     returnself;
}

@end


All I wanted to do was every time I draw my different flags the way that I do for the red flag in the top piece of code, I wanted to change the title, but no matter what I try, AddressAnnotation will not have dynamic titles. Can I just call something along the lines of :

Code:
redFag.title = @"unique title";
redFlag.subtitle = @"unique subtitle"

Thanks in advance!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.