4

I have a UITableView with static cells created in a storyboard. When the user touches a cell, another cell should hide/show. This is identical to how it looks in the built-in calendar app in iOS 7. It's basically the same question as this: How does one implement a view that slides out like the date picker in calendar? but I have a static table view and not a dynamic, otherwise the solution would have worked. If i try it, en exception is thrown.

As it is now, I can show and hide the cell at the row, but it is without animation, which isn't acceptable. This is the code I use:

- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 2 && indexPath.row == 0)
    {
        NSIndexPath *dateIndexPath = [NSIndexPath indexPathForRow:1
                                                        inSection:2];

        UITableViewCell *dateCell = [self.tableView cellForRowAtIndexPath:dateIndexPath];

        if (dateCell.hidden)
        {
            dateCell.hidden = NO;
        }
        else
        {
            dateCell.hidden = YES;
        }
    }
}
Community
  • 1
  • 1

1 Answers1

3

hye, i think you should refer this link, it will help you regarding hiding cells,

UITableView set to static cells. Is it possible to hide some of the cells programmatically?

Community
  • 1
  • 1
RicoRicochet
  • 2,249
  • 9
  • 28
  • 53
  • for adding cells to your static table you can refer, http://stackoverflow.com/questions/10043521/adding-unknown-number-of-rows-to-static-cells-uitableview – RicoRicochet May 20 '14 at 17:34