I am showing list of items on UITableViewCell in different sections. I have created UITextField in viewForFooterInSection delegate
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
Now my problem is i dont want to show viewForFooterInSection everytime. It should be nil/hidden until i click didSelectRowAtIndexPath for that particular section. And UITextField should show only for that section only.
I am confused how to reload footerView on click ?
You can reload the footer view simply by reloading the section.
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationNone];
After this call, - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
hits again, where you can keep a boolean variable and accordingly return nil or your footer view.
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
if(conditionSatisfied)
return myFooterView;
return nil;
}
HTH,
Akshay
The simplest answer is simply to call [tableView reloadData]
. Although this doesn't supply any sort of animation, I can't think of any nominally easy way to support animation in this case. It may be possible by inserting a row at the bottom of the section that looks like the footer, but that comes with another whole host of issues that I wouldn't want to deal with.
Edit: Just found a possibly slightly better option:
[tableView reloadSections:withRowAnimation:]
. I've no idea whether this will animate the footer or not, or whether it will even make the query to your data provider, but it's worth a shot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With