I have a tableviewcontroller and a detailtableviewcontroller when I pass an integer I get
-[UITableViewController setSurveyNumber:]: unrecognized selector sent to instance
Bizard thing is exact same code works for tableviewcontroller to -> uiviewcontroller
table -> table code
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if([segue.identifier isEqualToString:@"pushSurveyDetails"])
{
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
NSInteger row = [indexPath row];
SurveyDetailViewController *surveyController = [segue destinationViewController];
surveyController.surveyNumber=row;
}
}
in SurveyDetailViewController.h
@interface SurveyDetailViewController : UITableViewController
{
}
@property int surveyNumber;
@end
SurveyDetailViewController.m
@implementation SurveyDetailViewController
@synthesize surveyNumber;
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"Survey Number is %i",surveyNumber);
}
why this error occurs?
The error message indicates that [segue destinationViewController]
returns a UITableViewController
and not a SurveyDetailViewController
as expected.
The controller class can be set in the storyboard file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With