Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Riley Parsons
2,319 PointsUsing MapKit, adding annotations, implementing search feature.
I'm currently creating an application with tabbed view. In the first tab view there is a MKMapView with annotations for particular locations. I want an elegant and efficient way to store these annotations and need help doing so. I believe storing them in a plist would be the best option? I also want to use the second tab as a directory of sorts to access these annotations (wherever they might be stored). The second tab will implement a search bar that will search through the annotations. Any suggestions or help out there?
1 Answer
Amit Bijlani
Treehouse Guest TeacherData storage is always tricky. A few questions to help you make your decision:
- How big is the data set?
- Will the data be updated once the app is launched (assuming you are launching this in the app store)
- Are you searching only on the annotation title?
Riley Parsons
2,319 PointsRiley Parsons
2,319 PointsAt this point, I can't see the data set exceeding 50 annotations.
The data will definitely be updated eventually as I add more annotations and edit others with new information about the locations.
Most likely the search will only be for titles and subtitles of the annotations.
Thanks so much for your prompt reply, Amit, I really appreciate it. I would welcome any suggestions on how to put my ideas into action.
Amit Bijlani
Treehouse Guest TeacherAmit Bijlani
Treehouse Guest TeacherYour data set is small enough where you could get away with using a plist as you were planning. The only wrinkle is that you need to search through two separate fields: title and subtitle. In which case you might have to implement your own model to perform a search.
The other alternative is to go with SQLite using FMDB which will help you scale your application as your data grows. In addition, you will be able to use SQLite's search functionality which is a big win.