Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I thing that the best thing you could do is to store the cells configuration in some kind of structure (a set with the labels indices to be shown would be ok here) and alter this structure with your buttons and reload the table view. Then, on your tableView:cellForRowAtIndexPath: method, you should check that configuration structure in order to know what buttons should be visible.</p> <p>This code may help:</p> <pre><code>@interface MyViewController : UIViewController { ... NSMutableSet *_labelsToShow; } ... @property (nonatomic, retain) NSMutableSet labelsToShow @end @implementation MyViewController @synthesize labelsToShow = _labelsToShow; - (void)dealloc { [_labelsToShow release]; ... } //you may know which button has to add/remove each label, so this needs to be fixed with your logic - (IBAction)myButtonAction:(id)sender { if (hasToShowLabel) { [self.labelsToShow addObject:[NSNumber numberWithInteger:labelIdentifier]]; } else { [self.labelsToShow removeObject:[NSNumber numberWithInteger:labelIdentifier]]; } } -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifier = @"myCell"; MyCustomCell *cell = (MyCustomCell *)[tableView dequeReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { cell = [[[MyCustomCell alloc] initWithStyle:UITableViewCellStyleDefault] autorelease]; } cell.label0.hidden = (![self.labelsToShow containsObject:[NSNumber numberWithInteger:0]]); cell.label1.hidden = (![self.labelsToShow containsObject:[NSNumber numberWithInteger:1]]); cell.label2.hidden = (![self.labelsToShow containsObject:[NSNumber numberWithInteger:2]]); ... return cell; } @end </code></pre> <p>Good luck with this!</p>
 

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