I hope to fold the tableview cell , when I tap the red button
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if([[appDelegate.gHomeHeaderArray_AppDelegate objectAtIndex:section] getIsFolded]==true)
{
return 0;
}
else
{
return 1;
}
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if([[appDelegate.gHomeHeaderArray_AppDelegate objectAtIndex:section] getIsFolded ]==true)
{
return 0;
}
else
{
return 1;
}
}
-(void)buttonTapped:(id)sender;
{
if([[appDelegate.gHomeHeaderArray_AppDelegate objectAtIndex:v] getIsFolded])
{
[[appDelegate.gHomeHeaderArray_AppDelegate objectAtIndex:v] setIsFolded:false];
}
else
{
[[appDelegate.gHomeHeaderArray_AppDelegate objectAtIndex:v] setIsFolded:true];
}
[listview reloadData];
}
When I tape a button, it will check if set the numberOfRowsInSection to 0
it works, but the tableview cell move to under another header view rather than hiding.
Welcome any comment
Check out the following links it describe about collapse functionality of UITableview
https://github.com/floriankrueger/iOS-Examples–UITableView-Combo-Box/zipball/master
http://www.codeproject.com/Articles/240435/Reusable-collapsable-table-view-for-iOS
https://developer.apple.com/library/ios/#samplecode/TableViewUpdates/Introduction/Intro.html