Archived
1

Corrected errors when selecting expressions

This commit is contained in:
Kim Wittenburg
2014-09-08 22:43:20 +02:00
parent 4a3ff8606b
commit 91320385f0
3 changed files with 181 additions and 31 deletions

View File

@@ -10,6 +10,11 @@
@implementation NSIndexPath (MPAdditions)
- (NSUInteger)firstIndex
{
return [self indexAtPosition:0];
}
- (NSUInteger)lastIndex
{
return [self indexAtPosition:self.length-1];
@@ -58,7 +63,7 @@
return [[self indexPathByRemovingLastIndex] indexPathByAddingIndex:lastIndex];
}
- (NSIndexPath *)indexPathWithLength:(NSUInteger)length
- (NSIndexPath *)indexPathByRemovingIndexesFrom:(NSUInteger)length
{
NSIndexPath *indexPath = [[NSIndexPath alloc] init];
for (NSUInteger position = 0; position < length; position++) {
@@ -67,6 +72,15 @@
return indexPath;
}
- (NSIndexPath *)indexPathByRemovingIndexesTo:(NSUInteger)length
{
NSIndexPath *indexPath = [[NSIndexPath alloc] init];
for (NSUInteger position = length; position < self.length; position++) {
indexPath = [indexPath indexPathByAddingIndex:[self indexAtPosition:position]];
}
return indexPath;
}
- (NSIndexPath *)commonIndexPathWith:(NSIndexPath *)indexPath
{
NSIndexPath *commonPath = [[NSIndexPath alloc] init];