I have a simple storyboard consisting of two UIViewControllers, with a segue connecting them.
UIVC1 --> UIVC2
I'm trying to set a UILabel on UIVC2 to be equal to a string stored in UIVC1. I'm trying to pass the string in the prepareForSegue
method, and thus far I've set it to a property
in UIVC2.
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"mySegue"]) {
[segue.destinationViewController setDesc:[Brain description]];
}
}
The property in UIVC2 is desc.
Then, in my setDesc
method, which I've implemented, I run self.display.text = self.desc
where display
is my property for the UILabel.
However, this is not working, and even when I just NSLog the value of the UILabel, it doesn't print anything, which makes me wonder if the controller is even communicating with the UILabel... (I did do the ctr+click and drag thing in the storyboard to hook them up.)
Is there a better way to do this??
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…