Note that there are some explanatory texts on larger screens.

plurals
  1. POCell hidden property [tableView]
    primarykey
    data
    text
    <p>I have section:1 has 11 rows. I set height like this</p> <pre><code>- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == 0) return 350; else if (indexPath.section == 1) { return 150; } else return 0; } </code></pre> <p>if I set cell.hidden = YES; how can I remove the cell because if cell.hidden = YES it will be show space but I don't want that space I want if the cell is hidden directly remove from the secrion:1</p> <p>or if I can set height for every hidden cells for 0.0</p> <p>Thanks</p> <p><strong>EDIT</strong></p> <p>there is no NSArray for tableView it is customized like this</p> <pre><code>- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (section == 0) { return 1; } else if (section == 1) { int retype = [type intValue]; if (retype == 1 || retype == 5 || retype == 10) { return 0; } else if (retype == 11) { return 9; } else if (retype == 14) { return 4; } else { return 11; } } else return 0; } </code></pre> <p>and for the cell configure like this</p> <pre><code>static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (!cell) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; cell.selectionStyle = UITableViewCellSelectionStyleGray; } int truef = [*nsstring* intValue]; if (indexPath.section == 1) { if (indexPath.row == 0) { if (truef == 0) { cell.hidden = YES; } else { cell.titleLabel.text = @"True"; } } } </code></pre> <p><strong>EDIT 2</strong></p> <p>This the error after use deleteRowsAtIndexPaths</p> <pre><code>reason: 'Invalid update: invalid number of rows in section 1. The number of rows contained in an existing section after the update (11) must be equal to the number of rows contained in that section before the update (11), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload