Limiting the number of objects in NSArrayController

I am trying to create some kind of "Top 25" list in my application. I used NSPredicate to filter the contents of an array controller, but I want to limit the number of results to only 25 objects. How can i do this?

0
source share
2 answers

Another strategy would be to subclass NSArrayController and redefine organized objects to return something like [[super arrangedObjects] subarrayWithRange:NSMakeRange( 0, 25 )];(you probably want to check the length of the array first). Of course, this array controller would only be good for the top 25 and nowhere in your application.

+2
source

, { 0, 25 }, ( ) selection, selectedObjects.

+3

Source: https://habr.com/ru/post/1744433/


All Articles