Note that there are some explanatory texts on larger screens.

plurals
  1. POprepareForSegue is not called from UITableViewController
    text
    copied!<p>I have started iOS app development recently.</p> <p>I have a problem about segue from UITableViewController to UIViewController. "prepareForSegue" is not called when a tablecell is clicked.</p> <p>It seems to me that the code and interface builder settings are fine. Segue ID is properly set. I also embedded UITableVC in navigationVC, too. I set the breakpoint in the prepareForSegue, but it does not stop there and no log is generated. </p> <p>Through researching tips in the Internet, I understand that using didSelectRowAtIndexPath is one of the solutions for my problem. But I would like to understand the solution by using storyboard.</p> <p>This might be a basic question, but if someone could give me some tips, it could be very helpful.</p> <p>thank you,</p> <pre><code>@interface test2TVC () @property(strong,nonatomic) NSArray *items; @end @implementation test2TVC - (void)viewDidLoad { [super viewDidLoad]; self.items = @[@"item1", @"item2", @"item3", @"item4", @"item5", @"item6", @"item7", @"item8"]; } - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { NSLog(@"test log"); } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.items count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"]; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; cell.textLabel.text = [self.items objectAtIndex:indexPath.row]; return cell; } @end </code></pre>
 

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