Reputation: 75
I have a navigation controller and the first VC modals into the second one fine. I pressed ctrl+button
and dragged it over, all works fine.
I am doing a second segue from the first VC (again) and this time its another button, I am ctrl+button
and dragging it to the new VC and I get an USELESS error in XCODE -
2014-03-04 11:57:21.340 OutTonight[3173:60b] -[SettingsViewController setDealdetail:]: unrecognized selector sent to instance 0x16e686d0 2014-03-04 11:57:21.342 OutTonight[3173:60b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SettingsViewController setDealdetail:]: unrecognized selector sent to instance 0x16e686d0' * First throw call stack:
Here is my prepareforseguecode
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
NSIndexPath *indexPath = [self.tableview indexPathForSelectedRow];
DealViewController *detailView = (DealViewController *)segue.destinationViewController;
detailView.dealdetail = [self.allcontent objectAtIndex:indexPath.row];
detailView.dealpostcode = [self.allpostode objectAtIndex:indexPath.row];
detailView.dealvenuename = [self.allname objectAtIndex:indexPath.row];
detailView.dealaddress = [self.alladdress objectAtIndex:indexPath.row];
detailView.dealaddress2 = [self.alladdress2 objectAtIndex:indexPath.row];
detailView.deallat = [self.alllat objectAtIndex:indexPath.row];
detailView.deallng = [self.alllong objectAtIndex:indexPath.row];
detailView.userlatitude = [[NSUserDefaults standardUserDefaults] objectForKey:@"UserLatitude"];
detailView.userlongitude = [[NSUserDefaults standardUserDefaults] objectForKey:@"UserLongitude"];
}
Any ideas?
Upvotes: 0
Views: 94
Reputation: 2751
I assume you have done something in -prepareForSegue:
for the original segue? In which case, you need to make sure you are checking which segue it is in -prepareForSegue:
, and doing the correct thing for each one.
Edit:
To expand on my answer, I guess you are using segue.destinationViewController
, and calling setDealdetail:
on it. This probably worked fine for your initial segue, because the destinationViewController responded to that message, but, the destination for the new segue doesn't. You need to check which segue is being performed. Using [segue.identifier isEqualToString:MySegueIdentifierString];
Edit 2 (after posting code):
Ok, you need to check which segue is being performed in your -prepareForSegue:
. Something like this:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:SegueToDealViewControllerIdentifier]) {
NSIndexPath *indexPath = [self.tableview indexPathForSelectedRow];
DealViewController *detailView = (DealViewController *)segue.destinationViewController;
detailView.dealdetail = [self.allcontent objectAtIndex:indexPath.row];
detailView.dealpostcode = [self.allpostode objectAtIndex:indexPath.row];
detailView.dealvenuename = [self.allname objectAtIndex:indexPath.row];
detailView.dealaddress = [self.alladdress objectAtIndex:indexPath.row];
detailView.dealaddress2 = [self.alladdress2 objectAtIndex:indexPath.row];
detailView.deallat = [self.alllat objectAtIndex:indexPath.row];
detailView.deallng = [self.alllong objectAtIndex:indexPath.row];
detailView.userlatitude = [[NSUserDefaults standardUserDefaults] objectForKey:@"UserLatitude"];
detailView.userlongitude = [[NSUserDefaults standardUserDefaults] objectForKey:@"UserLongitude"];
}
}
Where SegueToDealViewControllerIdentifier
is the segue identifier for the original segue.
Upvotes: 1