Edited to Add * I haven't found a solution for this one yet, can anyone please help? My problem is similar to this but the answer posted doesn't t work for me - http://stackoverflow.com/questions/1190270/mkmapview-refresh-after-pin-moves *End Edit
I have a search enabled map view. When user hits search, my custom annotations are added to the map view. The search returns 20 results with a 'load more' link. When I hit load more, more annotations should be added to map view.
The problem is - annotations gets added to the map view but is not displayed on the map. If I zoom in or zoom out to change the map region, the pins are shown.
I find that viewForAnnotations: is not getting called when i hit 'load more'. I am not sure how to trigger this. any one?
-(void)completedSearch:(NSNotification *)resultNotification
{
//begin loop
//get coordinate
customAnnotation *annot = [[customAnnotation alloc] initWithCoordinate:coordinate];
//set title subtitle
[annotationsArray addObject:annot];
//end loop
[mView addAnnotations:annotationsArray];
[mView setRegion:region animated:YES];
[mView regionThatFits:region];
}
//custom annotation
@interface customAnnotation : NSObject <MKAnnotation>
{
CLLocationCoordinate2D coordinate;
NSString* title;
NSString* info;
}
@property (nonatomic, retain) NSSting *title;
@property (nonatomic, retain) NSSting *info;
-(id) initWithCoordinate:(CLLocationCoordinate2D)c;
@end
@implementation customAnnotation
@synthesize coordinate, title, info;
-(id) initWithCoordinate:(CLLocationCoordinate2D)c
{
coordinate = c;
return self;
}
-(void)dealloc{//dealloc stuff here}
@end