Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You haven't posted your <code>cellForRowAtIndexPath</code> but I am guessing you are wrongly reusing cells there. Check the answer to a similar question:</p> <p><a href="https://stackoverflow.com/questions/5080943/objective-c-uitableview-table-cells-display-wrong-content-after-changing-cell">Objective C UITableView - Table cells display wrong content after changing cell&#39;s height</a></p> <hr> <p>I tried with a code similar to yours and it seems to work as expected.</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. states = [[NSMutableArray alloc] init]; for (int i = 0; i &lt; 10; i++) { [states addObject:[NSNumber numberWithBool:false]]; } } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 10; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 1; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellId"]; cell.textLabel.text = [NSString stringWithFormat:@"Title @%d", indexPath.section]; cell.detailTextLabel.text = [NSString stringWithFormat:@"Subtitle @%d", indexPath.row]; return cell; } - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { NSNumber *state = [states objectAtIndex:indexPath.section]; [states replaceObjectAtIndex:indexPath.section withObject:[NSNumber numberWithBool:!state.boolValue]]; [self.tableView reloadData]; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { NSNumber *state = [states objectAtIndex:indexPath.section]; if (state.boolValue == false) { return 100; } else { return 244; } } </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