#pragma mark--算法tag
- (NSInteger)selectTag:(NSInteger)section row:(NSInteger)row selecBtn:(NSInteger)selectBtn
{
return (section << 18) | (row << 4) | selectBtn;
}
- (NSMutableArray *)getSection:(NSInteger)tag
{
NSMutableArray *totalArr = [NSMutableArray array];
[totalArr addObject:[NSString stringWithFormat:@"%ld",(tag & (0xfffc0000)) >> 18]];
[totalArr addObject:[NSString stringWithFormat:@"%ld",(tag & (0x0003fff0)) >> 4]];
[totalArr addObject:[NSString stringWithFormat:@"%ld",(tag & (0x0000000f))]];
return totalArr;
}
赋tag值
cell.collectBtn.tag = [self selectTag:indexPath.section row:indexPath.row selecBtn:1];
寻找控件
NSMutableArray *arr = [self getSection:btn.tag];
int section = [arr[0]intValue];
int row = [arr[1]intValue];
ZhuanTiTacticModel *model = _tacticArr[section][row];