Improved Model
Added Keyboard Selection Support Added Mouse Selection Support Added Keyboard Editing Support Corrected Some Bugs Abstracted the Layout System further Added Functions Button (test)
This commit is contained in:
@@ -10,6 +10,16 @@
|
||||
|
||||
@implementation NSIndexPath (MPAdditions)
|
||||
|
||||
- (NSUInteger)lastIndex
|
||||
{
|
||||
return [self indexAtPosition:self.length-1];
|
||||
}
|
||||
|
||||
- (NSIndexPath *)indexPathByReplacingLastIndexWithIndex:(NSUInteger)index
|
||||
{
|
||||
return [[self indexPathByRemovingLastIndex] indexPathByAddingIndex:index];
|
||||
}
|
||||
|
||||
- (NSIndexPath *)indexPathByRemovingFirstIndex
|
||||
{
|
||||
if (self.length <= 1) {
|
||||
@@ -34,4 +44,18 @@
|
||||
return [[NSIndexPath alloc] initWithIndexes:newIndexes length:self.length+1];
|
||||
}
|
||||
|
||||
- (NSIndexPath *)indexPathByIncrementingLastIndex
|
||||
{
|
||||
NSUInteger lastIndex = [self lastIndex];
|
||||
lastIndex++;
|
||||
return [[self indexPathByRemovingLastIndex] indexPathByAddingIndex:lastIndex];
|
||||
}
|
||||
|
||||
- (NSIndexPath *)indexPathByDecrementingLastIndex
|
||||
{
|
||||
NSUInteger lastIndex = [self lastIndex];
|
||||
lastIndex--;
|
||||
return [[self indexPathByRemovingLastIndex] indexPathByAddingIndex:lastIndex];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user