2

I have a sectioned table view in my application, but I want to collapse / expand rows in section, when this section is tapped.

I want to know the steps how to implement.

The data is imported from JSON file as a dictinary, and I have storyboard interface builder.

I want to show/hide rows of a specific section, when this section is tapped.

I am waiting for your answer.

Baby Groot
  • 4,637
  • 39
  • 52
  • 71
CarinaM
  • 527
  • 4
  • 12
  • 27
  • Have a look at [this tutorial](http://www.cocoanetics.com/2011/03/expandingcollapsing-tableview-sections/). There’s also [a component on GitHub](https://github.com/OliverLetterer/UIExpandableTableView). – lakshmen Mar 28 '13 at 07:06

1 Answers1

0

You can use these lines of code for this.

To add row

        NSIndexPath *tmpIndexpath=[NSIndexPath indexPathForRow:0 inSection:Sender.tag];
        [tbl_Qus insertRowsAtIndexPaths:[NSArray arrayWithObjects:tmpIndexpath, nil] withRowAnimation:UITableViewRowAnimationFade];

To delete row

        NSIndexPath *tmpIndexpath=[NSIndexPath indexPathForRow:0 inSection:Sender.tag];
        [tbl_Qus deleteRowsAtIndexPaths:[NSArray arrayWithObjects:tmpIndexpath, nil] withRowAnimation:UITableViewRowAnimationFade];

You can download tutorial also from this link.

Baby Groot
  • 4,637
  • 39
  • 52
  • 71