If you need to get the first n items in an NSArray in Objective C then you can use the subarrayWithRange: method. This method will work to get any range of items of an array and will return a new array containing those items. For example, to get the first 20 elements of the NSArray myArray, try this:

To get the last 20 elements simply update the range like this:

Using the MIN() and MAX() macros help ensure the range is within the bounds of the NSArray.