Open narasimhanallamsetty opened 9 years ago
Hi @narasimhanallamsetty
first you have to allow multiple selections:
// Set this if you want to allow multiple selection
[accordion setAllowsMultipleSelection:YES];
and then you can set setSelectionIndexes
:
[accordion setSelectionIndexes:indexesToOpen];
Hi @suda
Thanks for the reply, I have set [accordion setAllowsMultipleSelection:YES]; in my ViewController.m
But Where I should call [accordion setSelectionIndexes:indexesToOpen]; code, I am not sure. Could you explain more. Please bear with me. Thank you.
You should call setSelectionIndexes
where you initialise accordion. indexesToOpen
is a NSIndexSet instance containing indexes you want to be opened.
accordion = [[AccordionView alloc] initWithFrame:CGRectMake(10, 60, 300, [[UIScreen mainScreen] bounds].size.height-30)];
[containerView addSubview:accordion];
[accordion setSelectionIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 1)]];
If I did any mistake please let me know. still it's not working for me.
Hi,
This is very nice tutorial,exactly what I was looking for. But I need to open 2 sections(Headers) when view loads. Right now I am able to open one section when view loads. How can I open 2 or more sections when view loads.
When I added the below lines section one is opened with animation if (!self.startsClosed && [selectionIndexes count] == 0) { [self setSelectedIndex:0]; }
In the same way I tried for second section, but it's not working for me. May be I need to make changes some where else. if (!self.startsClosed &&[selectionIndexes count] == 2) { [self setSelectedIndex:2]; }
Please help me out. Once again thanks for your great work.