Enr*_*iMR -1 objective-c subtraction ios
有没有办法用Objective-C减去两个或更多NSUInteger值?
这是我的代码
__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;
}
}];
Run Code Online (Sandbox Code Playgroud)
当我尝试使用idx-removedElementsCount创建新的NSIndexPath时,出现以下错误:
HTReorderTableCells.m:231:75: Invalid operands to binary expression ('NSUInteger' (aka 'unsigned int') and 'NSUInteger *' (aka 'unsigned int *'))
Run Code Online (Sandbox Code Playgroud)
我找了一个解决方案,但我没找到任何东西.
使用NSInteger作为解决方案.
NSUInteger value1 = 5;
NSUInteger value2 = 3;
NSInteger subs = value1 - value2;
Run Code Online (Sandbox Code Playgroud)
在你的代码中修复声明removedElementsCount(删除*)
| 归档时间: |
|
| 查看次数: |
1065 次 |
| 最近记录: |