Created
September 6, 2013 09:31
-
-
Save pablocarrillo/6461590 to your computer and use it in GitHub Desktop.
Fast range of indexPath utility
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
*\brief Method to get an array of index path from a NSRange | |
* This method can be used to get an array of indexPath for table updates, | |
* just one range and section each time. | |
*\param range The range you need for the indexPath | |
*\param the section you want for the indexPath | |
*\return A Mutable array of NSIndexPath | |
*/ | |
+ (NSMutableArray*)arrayOfIndexPathFromRange:(NSRange)range section:(NSUInteger)section{ | |
NSMutableArray *returnArray=[NSMutableArray new]; | |
NSInteger i=0; | |
while (i<range.length) { | |
i++; | |
[returnArray addObject:[NSIndexPath indexPathForRow:(range.location+i) inSection:section]]; | |
} | |
return returnArray; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment