无法识别的选择器发送到ios表视图单元格上的实例单击

时间:2014-07-26 18:28:31

标签: ios storyboard unrecognized-selector

我是iOs的初学者。我将在表视图控制器中查看列表。我的应用程序是故事板应用程序。我做了以下代码转到下一个视图。

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   LawyerViewController *dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"LawyerViewController"];
   dvc.lawyer = @"Thisara";//[self.myObject objectAtIndex:indexPath.row];
   [self.navigationController pushViewController:dvc animated:YES];
}

在我的LawyerViewController头文件中,我定义了以下属性。

@property (nonatomic, strong) NSString *lawyer;

当我点击该单元格时,我发现了以下错误。

2014-07-26 23:56:14.420 lawyerapp[3626:60b] -[UIViewController setLawyer:]: unrecognized        selector sent to instance 0x8cdd1f0
2014-07-26 23:56:14.424 lawyerapp[3626:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController setLawyer:]:      
unrecognized selector sent to instance 0x8cdd1f0'

我该如何解决这个问题。

提前致谢!

1 个答案:

答案 0 :(得分:5)

您尚未在storyBoard中定义该课程。

转到StoryBoard中的viewController - >  比identity Inspector - > class - >上课LawyerViewController

enter image description here 清洁,构建和运行