开发者

How to search a directory and display search results in a table in Objective-C

开发者 https://www.devze.com 2023-02-09 22:57 出处:网络
I want to 开发者_运维问答create an iTunes style search function where a searchfield will look through the contents of a directory and display the results in an NSTableView.

I want to 开发者_运维问答create an iTunes style search function where a searchfield will look through the contents of a directory and display the results in an NSTableView.

This would be specifically for music so the searchfield should match either song name, artist name or song name.

Is there a way to do this in Objective-C without having the contents of the directory added into the NSTableView first?


You'll want to use Spotlight for searching meta-data like artists and other song information:

  • Introduction to Spotlight
  • Spotlight query sample code

SearchKit focus OTOH is on content search.


where is the "directory" located? are you talking about an actual directory on your local filesystem? I suggesting populating an array with the contents of a directory listing and then using on of the many howto's to get a search to populate a tableView.

http://cocoadev.com/index.pl?NSTableViewTutorial lesson 6


This is generally what SearchKit is for. It gives you access to the spotlight metadata, so that you can search for information like this very quickly.

0

精彩评论

暂无评论...
验证码 换一张
取 消