Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.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
Ios 以编程方式调用Popover Segue时崩溃_Ios_Uistoryboard_Uistoryboardsegue - Fatal编程技术网

Ios 以编程方式调用Popover Segue时崩溃

Ios 以编程方式调用Popover Segue时崩溃,ios,uistoryboard,uistoryboardsegue,Ios,Uistoryboard,Uistoryboardsegue,我使用的是XCode 4.2故事板。 最初,我将一个Popover Segue锚定到嵌入导航控制器的UIViewController上的UIButton上,一切正常 现在,我需要在执行segue之前添加条件行为,因此我执行了以下操作: 删除了segue 从UIViewController创建了一个新的segue 从按钮创建iAction 在IBAction中调用了[self-PerformsgueWithIdentifier:@“mySegue”发件人:self] 该应用程序通过了prepa

我使用的是XCode 4.2故事板。 最初,我将一个Popover Segue锚定到嵌入导航控制器的UIViewController上的UIButton上,一切正常

现在,我需要在执行segue之前添加条件行为,因此我执行了以下操作:

  • 删除了segue
  • 从UIViewController创建了一个新的segue
  • 从按钮创建iAction
  • 在IBAction中调用了
    [self-PerformsgueWithIdentifier:@“mySegue”发件人:self]
该应用程序通过了prepareForSegue,但随后抛出一个SIGABRT并记录以下内容

 \*** Assertion failure in -[UIStoryboardPopoverSegue perform], /SourceCache/UIKit_Sim/UIKit-1912.3/UIStoryboardPopoverSegue.m:27
有什么想法吗?我还有其他例子可以很好地使用推式分段。这是一个行为不端的爆米花的例子,我不断听到的参考

可能有点晚了:

锚定定义了要显示且未连接到动作的popover的起点。它必须被设置

因此,当您希望以编程方式调用popover segue时,必须分两步进行:

1。将Segue连接到ViewController您只需从执行Segue的ViewController拖动到目标ViewController,然后选择Popover

2。定义标识符这是调用代码执行序列所必需的

3。连接锚定点将锚定点拖动到希望弹出框从其开始的对象。在下图中,这是一个巴布托教派。注意:这不会自动执行segue!(这样,您还可以执行一些连接到BarButtonItem的操作)

4。从代码中调用segue

    [self performSegueWithIdentifier:@"yourIdentifier" sender:sender];

你有没有给这个赛格一个识别码(名字)?是的。它正在成功地进行prepareForSegue:(你解决了吗?你设置了锚吗?没有解决。必须构建一个自定义的segue作为解决方案。我从头开始尝试了相同的场景,但遇到了相同的问题。设置锚是什么意思?重点是我需要移除锚以获得条件行为。不确定这是否可以解决手头的特定问题,但必须在初始化视图后调用[self-PerformsgueWithIdentifier:@“mySegue”发送者:self],否则会出现类似的异常