0

AddSourceViewController单击按钮时,我想用标识符打开一个新视图。我正在使用以下代码来执行此操作:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"AddSourceViewController"];
[vc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentModalViewController:vc animated:YES];

当在viewDidLoad初始视图中使用时,此代码可以完美运行并打开附加视图。但是,我在初始视图上的按钮上添加了一个 IBAction,当我添加上面的代码以尝试在按钮单击时打开新视图时,我只得到一个Thread 1: breakpoint 5.1 6.1. 我怎样才能让它在按钮动作上起作用?

编辑:下面更好的错误信息。

2012-11-23 16:33:40.399 Marketr[23454:c07] -[SecondViewController addSourceButton:]: unrecognized selector sent to instance 0x6e2f5c0
2012-11-23 16:33:40.400 Marketr[23454:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SecondViewController addSourceButton:]: unrecognized selector sent to instance 0x6e2f5c0'
4

1 回答 1

2

您是否为您的操作方法设置了断点?查看该方法的代码旁边的左侧,看是否有一个蓝色箭头指向代码。

于 2012-11-23T21:24:56.327 回答