Skip to content

cannot handle click close or open #19

Description

@thangk48cc

in Lib don't have delegate to know. 1 header is close or open.
i must add Notification Center to handle it

  • (void)toggleSection:(NSUInteger)sectionIndex animated:(BOOL)animated
    {
    if (sectionIndex >= [self.sectionsStates count])
    {
    return;
    }

    BOOL sectionIsOpen = [[self.sectionsStates objectAtIndex:sectionIndex] boolValue];

    if (sectionIsOpen)
    {
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"%lu",(unsigned long)sectionIndex],@"sectionIndex",@"0",@"status", nil];

    [[NSNotificationCenter defaultCenter] postNotificationName:@"chooseSection" object:nil userInfo:dic];
    [self closeSection:sectionIndex animated:animated];
    

    }
    else
    {
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"%lu",(unsigned long)sectionIndex],@"sectionIndex",@"1",@"status", nil];

    [[NSNotificationCenter defaultCenter] postNotificationName:@"chooseSection" object:nil userInfo:dic];
    
    [self openSection:sectionIndex animated:animated];
    

    }
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions