0

I want to create a tableView or tabs that expands when user selects them. This is very commonly used in webpages using jquery. rows expand on user selection you can check http://jqueryui.com/accordion/ It does exactly what i want to do in my ipad app. with horizontal tabs too http://jqueryui.com/tabs/

Can anyone tell me how to achieve this in my iPad app ? Or any pointers would be appreciated.

TIA Sam

Tarek Hallak
  • 18,422
  • 7
  • 59
  • 68
Sam
  • 440
  • 6
  • 18

2 Answers2

1

1.Use UITableView for first type of tab.

a) Use Header and Cell View in your desired format.

b) Hide and unhide cell view with some animation.

2.Use UISegementedControl for second type of tab.

a) Use function addTarget :

[self.mySegmentedControl addTarget:self action:@selector(segmentChanged) forControlEvents:UIControlEventValueChanged];

b) Implement segmentChanged :

- (void) segmentChanged:(UISegmentedControl *)paramSender{

//check if its the same control that triggered the change event
 if ([paramSender isEqual:self.mySegmentedControl]){

    //get index position for the selected control
    NSInteger selectedIndex = [paramSender selectedSegmentIndex];

   if (selectedIndex == 1 ) { // do required } and so on....

  }
}
Samkit Jain
  • 2,523
  • 16
  • 33
  • I checked the [apple sample code](http://developer.apple.com/library/ios/samplecode/TableViewUpdates/Listings/TVAnimationsGestures_APLAppDelegate_m.html) and other libraries like [JKExpandTableView](https://github.com/jackkwok/JKExpandTableView),[UIExpandableTableView](https://github.com/OliverLetterer/UIExpandableTableView), but ended up implementing my own solution with customized headerView. Here is a good tutorial which helped me http://blog.paxcel.net/blog/expandablecollapsible-table-for-ios/. Thanks! – Sam Aug 23 '13 at 04:53
0

The best possible way is using the headerview to show the Master row and the tableview cells for showing the Details row.Write a touch event for the headerview and set it with the showing and hiding the cells ,with neat row animation.You need to keep the status of the opened and closed state of cell with an array of bools repesenting the no of masterview.

Lithu T.V
  • 19,955
  • 12
  • 56
  • 101