Is there any way of subtract two or more NSUInteger values with Objective-C?
This is my code
__block NSUInteger *removedElementsCount = 0;
__block BOOL lastIsSuperElement = NO;
// Get the elements not collapsed
[_elements enumerateObjectsUsingBlock:^(id __nonnull obj, NSUInteger idx, BOOL * __nonnull stop) {
if (_isHidingSubElementsBlock(obj)){
//_collapseSubCellsAtIndexPathBlock(idx+_elementsOffset);
[elementToRemove addObject:(Task *)obj];
lastIsSuperElement = YES;
[indexPathToRemove addObject:[NSIndexPath indexPathForRow:(idx-removedElementsCount) inSection:0]];
removedElementsCount = 0;
} else if (lastIsSuperElement){
removedElementsCount++;
lastIsSuperElement = NO;
}
}];
When I try to create a new NSIndexPath with idx-removedElementsCount, I get the following error:
HTReorderTableCells.m:231:75: Invalid operands to binary expression ('NSUInteger' (aka 'unsigned int') and 'NSUInteger *' (aka 'unsigned int *'))
I have looked for a solution but I haven't found anything.
Use NSInteger for your solution.
NSUInteger value1 = 5;
NSUInteger value2 = 3;
NSInteger subs = value1 - value2;
In your code fix the declaration of removedElementsCount
(remove *)