Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c segue destinationViewController未检测到目标方法_Objective C_Ios5_Storyboard_Segue_Uistoryboardsegue - Fatal编程技术网

Objective c segue destinationViewController未检测到目标方法

Objective c segue destinationViewController未检测到目标方法,objective-c,ios5,storyboard,segue,uistoryboardsegue,Objective C,Ios5,Storyboard,Segue,Uistoryboardsegue,我有一个故事板,使用分段在视图之间导航 我正在使用以下代码 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"thestring"]) { [[segue destinationViewController] function1:argument1:argument2]; [[se

我有一个故事板,使用分段在视图之间导航

我正在使用以下代码

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    if ([[segue identifier] isEqualToString:@"thestring"]) {
        [[segue destinationViewController] function1:argument1:argument2];
        [[segue destinationViewController] function2:argument1:argument2];

    }
}
出于某种原因,它将功能1识别为目标视图控制器的成员,而不是功能2,它会向我显示当前错误:

no known instance method for selector 'function2'
function2被指定为目标视图控制器的公共函数(前面有一个“-”,它也在目标视图控制器的代码中使用

为什么它没有检测到它

谢谢

编辑

标题声明如下

-(void)function2:(NSString*)argument1:(NSString*)argument2;

使用强制转换告诉编译器什么类
destinationController
实际上是的实例。

您可以发布您的实际方法签名(目标控制器中的声明)吗?您是否在标头中声明了它并将标头导入类中?@alladinian I添加了该方法declaration@Dustin ,我已经在我的标题中声明了它(它正在目标控制器中使用),并且它被正确地导入到我的类中(检测到function1)。谢谢Philip,我是iOS开发的新手,你能给我一个cast的例子吗?它与iOS无关,只是基本的C语言编程。类似于:
[(MyControllerClassName*)[segue destinationViewController]函数2:argument1:argument2]。我是iOS开发新手,尝试在线搜索,但找不到示例,您能给我一个快速示例吗?我之前的评论中有一个示例。插入您自己的类名,它应该可以工作。(我猜不出你把视图控制器叫做什么。)实际上这是一个完全不同的问题,我只是忘记了在当前目标文件中包含目标类头文件。我在尝试键入MyControllerClass名称时发现了这一点。谢谢