1。位置索引:base_index = 0
2。UITableView.h 针对表进行删除或移动 rows / sections操作
- (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath //移动row
- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection //移动section
NSIndexPath *indexPath = [NSIndexPath indexPathForRow : rowIndex inSection : sectionIndex];
- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation //删除rows ,indexPaths : array Of indexPath
NSIndexSet *section = [NSIndexSet indexSetWithIndex: sectionIndex]; //indexSetWithIndexesInRange : 多个sections
- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation //删除sections
3。更改与表相对应数据源里的数据,以下是对应的关于集合的使用
NSMutableArray *mutAry = [[NSMutableArray alloc] init] ; //普通初始化
NSMutableArray *mutAry = [[NSMutableArray alloc] initWithArray:@[@num1, @num2 , @num3 ] ] ; //用数值对象初始化
[mutAry indexOfObject : numberObject ] : >=0 / NSNotFound //对象在数组中的索引位置
[mutAry addObject : object ] ; //数组增加对象元素
NSMutableDictionary *mutDic = [[NSMutableDictionary alloc] initWithDictionary:@{ keyString : mutAry1 , keyString2 : mutAry2 } ] ;
mutDic.allKeys , mutDic[key] ; //获取
[mutDic removeObjectForKey : key ] ; //通过key删除
迭代执行:
__block NSUInteger keyIndex = 0; //在块中使用可更改的变量,声明要用__block
[mutDic enumerateKeysAndObjectsUsingBlock: ^(NSString *key, NSMutableArray *aryObj, BOOL *stop) {
[aryObj enumerateObjectsUsingBlock: ^(NSNumber *number, NSUInteger numberIndex, BOOL *stop) {
NSUInteger num = [number unsignedIntegerValue] ;
。。。。
}];
keyIndex++;
}];