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 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.
精彩评论