ExpandableTableView icon indicating copy to clipboard operation
ExpandableTableView copied to clipboard

If isMultipleSelected is set to NO, getting exception when button of same section is tapped multiple times.

Open rahulsingh1101 opened this issue 7 years ago • 1 comments

When I made isMultipleSelected NO, it is working fine if I will tap on buttons of different sections. But if I tap on the button of same section for 2 times, it will give exception if I will tap button of any section for 3rd time.

rahulsingh1101 avatar Aug 29 '17 10:08 rahulsingh1101

Dear RAhul,

Replace This function its start working :)

-(IBAction)btnTapShowHideSection:(UIButton*)sender { if (!sender.selected) { if (!isMultipleExpansionAllowed) {

        if(_arrSelectedSectionIndex.count == 0){
            [_arrSelectedSectionIndex addObject:[NSNumber numberWithInteger:sender.tag-1]];
        }else{
            [_arrSelectedSectionIndex replaceObjectAtIndex:0 withObject:[NSNumber numberWithInteger:sender.tag-1]];
        }
        
    }else {
        [_arrSelectedSectionIndex addObject:[NSNumber numberWithInteger:sender.tag-1]];
    }

    sender.selected = YES;
}else{
    sender.selected = NO;
    
    if ([_arrSelectedSectionIndex containsObject:[NSNumber numberWithInteger:sender.tag-1]])
    {
        [_arrSelectedSectionIndex removeObject:[NSNumber numberWithInteger:sender.tag-1]];
    }
}

if (!isMultipleExpansionAllowed) {
    [tblView reloadData];
}else {
    [tblView reloadSections:[NSIndexSet indexSetWithIndex:sender.tag-1] withRowAnimation:UITableViewRowAnimationAutomatic];
}

}

alinaveed123 avatar Mar 26 '19 10:03 alinaveed123