views:

9

answers:

2

Hi

I want to implement search on Mkmapview. I mean searching all the annotation pins based on their title or subtitle.

Please let me know if there is any way.. I have been searching this on web from the last couple of days. NO clue till now. Please let me know.

thanks in advance.

suresh

A: 

Just iterate over the annotations ivar of your MKMapView instance and look if they match.

JustSid
A: 

Try this :

for(MKAnnotation* currentAnnotation in yourMapView.annotations)
{
     if([currentAnnotation.title isEqualToString:@"titleSearched"])
     {
          // currentAnnotation is the annotation you searched
     }
}
MathieuF
thank you for the answer. is there any way i can hide a location instead of deleting..?my application requires...some thing searching on various categories.for eg: search on coach stations and railway stations. i am using UISegmented control to filter the locations.initially i load all the locations and when i click on Coach stations locations, i need to hide train stations locations. And when i click on train stations, i need to hide coach stations and display train stations.I know that i can remove the mkannotationviews. But is there any way without removing the annotations..?
suresh babu