Git Product home page Git Product logo

Comments (1)

CodeWicky avatar CodeWicky commented on August 11, 2024

Hi bro, I'm sorry for answering u so late.

I can't understand what do you mean by

With multiSelect YES, the multi checkbox is not setting correctly, only with multiSelect NO.

I use DWCheckBox in my own project with MultiSelectMode and it works.

I guess u r trying to build a DWCheckBoxManager yourself to fit your demand and these may help you:

All you need to do in selectedChangeBlock is to change all cell's selectStatus.

So u may initial a manager like this:

DWCheckBoxDefaultLayout * layout = [DWCheckBoxDefaultLayout new];
    
    CustomCheckBoxCell * cell1 = [CustomCheckBoxCell buttonWithType:(UIButtonTypeCustom)];
    [cell1 setFrame:CGRectMake(0, 0, 44, 44)];
    CustomCheckBoxCell * cell2 = [CustomCheckBoxCell buttonWithType:(UIButtonTypeCustom)];
    [cell2 setFrame:CGRectMake(0, 0, 44, 44)];
    NSArray * cells = @[cell1,cell2];
    
    DWCheckBoxManager * manager = [[DWCheckBoxManager alloc] initWithCountOfBoxes:cells.count multiSelect:YES defaultSelect:@[@1] selectedChangeBlock:^(DWCheckBoxManager *mgr, id currentSelect, NSString *identifier) {
        NSArray * arr = currentSelect;
        [cells enumerateObjectsUsingBlock:^(id<DWCheckBoxCellProtocol> obj, NSUInteger idx, BOOL * _Nonnull stop) {
            if ([arr containsObject:@(idx)]) {
                [obj cellBeSelected:YES withImage:mgr.selectedImage];
            } else {
                [obj cellBeSelected:NO withImage:mgr.unSelectedImage];
            }
        }];
    }];
    
    DWCheckBoxView * view = [[DWCheckBoxView alloc] initWithFrame:CGRectMake(0, 64, 414, 672) layout:layout manager:manager multiSelect:YES cells:cells];
    [self.view addSubview:view];

Code above works on multiSelectMode.And I've update DWCheckBox to 1.1.0 which provide defaultManager.

Hope to help u.

from dwcheckbox.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.