Note that there are some explanatory texts on larger screens.

plurals
  1. POdidSelectRowAtIndexPath not working?
    primarykey
    data
    text
    <p>Trying to determine why I can't get my new "Arts" menu to show after being selected in <code>didSelectRowAtIndexPath.</code> I realize it is not being used correctly... also, is there a way I can make it show after two taps, or does <code>didSelectRowAtIndexPath</code> by default only work on once press?</p> <pre><code>-(void)viewDidAppear:(BOOL)animated { NSString *arts = @"Arts and Museums"; [arrayNo addObject:arts]; [[self myTableView] reloadData]; } - (void)viewDidLoad { [super viewDidLoad]; arrayNo = [[NSMutableArray alloc] init]; [[self myTableView] setDelegate:self]; [[self myTableView] setDataSource:self]; } -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [arrayNo count]; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (!cell) { NSLog(@"CREATING NEW CELL"); cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; cell.textLabel.textColor = [UIColor whiteColor]; cell.textLabel.textAlignment = NSTextAlignmentCenter; cell.textLabel.textColor = [UIColor colorWithRed:(100/255.0) green:(130/255.0) blue:(255/255.0) alpha:1.0]; } cell.textLabel.text = [arrayNo objectAtIndex:indexPath.row]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if ([cell.textLabel.text isEqualToString: @"Arts and Museums"]) { NSString *galleries = @"Art Galleries"; NSString *dramatic = @"Dramatic Arts"; NSString *museums = @"Museums"; [arrayNo addObject:galleries]; [arrayNo addObject:dramatic]; [arrayNo addObject:museums]; [self.myTableView reloadData]; } } </code></pre> <p><em><strong></em>**<em>*</em>**<em>*</em>**<em>*</em>***<em></strong> UPDATED <strong></em>**<em>*</em>**<em>*</em>**<em>*</em>****</strong></p> <p>After updating my <code>didSelectRowAtIndexPath</code> with the code below, I see that it is referencing it, but my new menu items are not popping up to replace the old array. I tried using <code>self.myTableView = nil</code> and reloading the data but it would appear it has no effect?</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; if ([cell.textLabel.text isEqualToString: @"Arts and Museums"]) { NSString *galleries = @"Art Galleries"; NSString *dramatic = @"Dramatic Arts"; NSString *museums = @"Museums"; [arrayNo addObject:galleries]; [arrayNo addObject:dramatic]; [arrayNo addObject:museums]; NSLog(@"LOADED"); } } </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.
 

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