Answer the question
In order to leave comments, you need to log in
How to make segue?
It is not possible to make Segue, the problem is in PrepareForSegue.
Help fix please
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
if ([sender isKindOfClass:[UITableViewCell class]])
{
UITableViewCell *cell = (UITableViewCell *)sender;
NSString *tmpStr = cell.textLabel.text;
VCViewController *destinationController = (VCViewController *) segue.destinationViewController;
[segue.destinationViewController setMyProperty:tmpStr];
}
}
Answer the question
In order to leave comments, you need to log in
I think the problem is that you need to replace
[segue.destinationViewController setMyProperty:tmpStr];
on
[destinationController setMyProperty:tmpStr];
the class does not have such a field,
1. look in the storyboard that you have the required class written there and
2. make sure that this class has such a property
3. add this log and most likely you will see that the wrong class is there
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
if ([sender isKindOfClass:[UITableViewCell class]])
{
UITableViewCell *cell = (UITableViewCell *)sender;
NSString *tmpStr = cell.textLabel.text;
VCViewController *destinationController = (VCViewController *) segue.destinationViewController;
NSLog(@"%@", destinationController.class);
[segue.destinationViewController setMyProperty:tmpStr];
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question