开发者

Search bar like Finder's, with possibilities to add search parameters

开发者 https://www.devze.com 2023-04-12 08:02 出处:网络
I\'d like to create some开发者_如何学Pythonthing like this: I can make a custom controller (maybe using a `NSCollectionView ) but it\'s a lot of work. Does anyone know a library or workaround in Co

I'd like to create some开发者_如何学Pythonthing like this:

Search bar like Finder's, with possibilities to add search parameters

I can make a custom controller (maybe using a `NSCollectionView ) but it's a lot of work. Does anyone know a library or workaround in Cocoa?


The basic Cocoa machinery for the typical app is NSPredicate (to filter your content), and an NSPredicateEditor control.

To get fancy (have the field grow and shrink, pushing content down as rules are added), you'll need to manage / animate the views yourself as predicates are added / removed. You'll observe the view for frame changes adjust/animate the "search filter" view in your app to push down the content, etc.

Even fancier: If too many rules are added, there won't be any more room for content, so you'll need to figure out a sane limit, at which point you stop growing the view and let scrolling take over.

0

精彩评论

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