Loading

Tuesday, July 20, 2010

What is Annotation ???

It is a pre-Declared Class.
You have to define it in your project.
The Annotation class must have three property
1-> coordinate
2-> title
3-> subtitle

:)
also declare and define method for initiate Annotation (it is user Define)

Example :-
Add New Class in Project Named MyAnnotaion
MyAnnotation.h

@interface MyAnnotation : NSObject {
CLLocationCoordinate2D _coordinate;
NSString* title;
NSString* subtitle;
}

@property (nonatomic, retain)NSString* title;
@property (nonatomic, retain)NSString* subtitle;

- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate: (NSString*)annTitle : (NSString*)annSubTitle;
@end

MyAnnotation.m

@synthesize coordinate=_coordinate;
@synthesize title;
@synthesize subtitle;


- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate: (NSString*)annTitle : (NSString*)annSubTitle{
self = [super init];
if (self != nil) {
_coordinate = coordinate;
title = annTitle;
subtitle = annSubTitle;
}
return self;
}



No comments:

Post a Comment