Thursday, 8 August 2013

Find NSDate in sorted NSArray

Find NSDate in sorted NSArray

I have a sorted array of NSDate objects. What I'd like to do is create a
method that takes in a date and returns YES or NO depending on whether
that date can be found in the date array.
NSArray *dateArray;
-(BOOL)arrayContainsDate(NSDate *)d {
// return YES if d is found in dateArray
}
I know how to do this by going through each element of the array one by
one, but I need a quicker way.

No comments:

Post a Comment