0
votes

I am creating a simple sign up/login screen. I am using static cells as follows:

enter image description here

The cells are static. I want that when I click the sign up button I add 2 more cells to the tableview. Is that possible considering that I am using static cells and not dynamic?

UPDATE:

I am trying to set the height to 0.0f inside the heightForRowAtIndexPath but it is blowing up.

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; // this line 

    if(cell.tag == 2)
        return 0.0f;

    return cell.frame.size.height;
}
2
Why does this even need to be a UITableView?matt
You can easily implement this using just a UIScrollView and some simple animations.Rameez Hussain

2 Answers

0
votes

When you reload the table and it asks for the size you would add 2 more to it. Just based on the row index you would decide to use the static cells or whatever else you are inserting.

0
votes

Your question is not very clear but it appears that you have 2 cells in the image. That means you're trying to go from 2 to 4 cells once your signup code has run. Simply put the 4 static cells in your storyboard UITableView and implement the following method and call [self reloadData] to trigger it:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (SIGNUP_CODE_HAS_RUN == YES)
    {
        // where SIGNUP_CODE_HAS_RUN is set to YES after you've run your signup code
        return 4;
    }
    else
    {
        return 2;
    }
}