Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Ah, I think your issue is that you have a button that calls a segue and calls code. You should only do one or the other. So you'll want to remove that ibaction for show answer and use something like:</p> <pre><code>- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"WhateverMySegueIsNamed"]) { MyViewController *controller = segue.destinationViewController; controller.textViewanswer1.text = [answers objectAtIndex:step]; } } </code></pre> <p>What I typically do for something like that is instead of setting the text on a label on a view controller that isn't the one I'm working on I'll pass the text as a property and do it on viewWillAppear instead. Something like:</p> <pre><code>- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"WhateverMySegueIsNamed"]) { MyViewController *controller = segue.destinationViewController; controller.AnswerString = [answers objectAtIndex:step]; } } </code></pre> <p>then on the view will appear I'd have something like</p> <pre><code>[super viewWillAppear:animated]; self.lblAnswer.text = self.AnswerString; </code></pre> <p>It's also important if you're using properties to use the "self" keyword, I've had instances (in other languages as well) where I thought I was setting a property on the object I was working on but it was actually setting a value on another object or creating a new object all together and setting that value. Hope that helps!</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