Silviu St
Silviu St

Reputation: 1842

How can i get all SKMap location objects so I can filter trough them?

I use SKMap in a offline navigation iOS application and:

I'm trying to search from a UITextField a street/city/district within a preinstalled map and I want to get all objects that matches my search. How can I get all map location objects so I can filter trough them? From the sample didn't quite managed to do so.(I get only cities)

Is there other alternative or I must loop trough every city and get streets (Seems ugly)

Upvotes: 0

Views: 130

Answers (1)

SylviA
SylviA

Reputation: 1577

You have to use SKNearbySearchSettings class and to set

searchObject.searchType = SKAll;

A more detailed example of using this class (should return all streets and POIs containing the "pizza" keyword):

SKNearbySearchSettings *searchObject = [SKNearbySearchSettings nearbySearchSettings];

searchObject.coordinate = CLLocationCoordinate2DMake(52.5233, 13.4127); 
searchObject.radius = 40000;        
searchObject.searchMode = SKSearchHybrid;
searchObject.searchResultSortType  = SKMatchSort;    
searchObject.searchType = SKAll;
searchObject.searchTerm = "pizza";

[[SKSearchService sharedInstance]startNearbySearchWithSettings:searchObject];

Upvotes: 3

Related Questions