rut*_*hie 3 ios uistoryboard uistoryboardsegue
我正在使用XCode 4.2故事板.最初我在一个嵌入在导航控制器中的UIViewController上有一个固定到UIButton的Popover Segue,一切都很顺利.
现在我需要在执行segue之前添加条件行为,所以我做了以下事情:
[self performSegueWithIdentifier:@"mySegue" sender:self]在IBAction中调用应用程序通过prepareForSegue,然后它会抛出SIGABRT并记录以下内容
\*** Assertion failure in -[UIStoryboardPopoverSegue perform], /SourceCache/UIKit_Sim/UIKit-1912.3/UIStoryboardPopoverSegue.m:27
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?我有其他这种工作正常推送segues的情况.这是一个我一直听到参考的行为不端的邮件吗?
el *_*lex 10
也许有点晚了:
锚定义了要显示的弹出窗口的起点,并且未连接到动作.必须设置它.
因此,当您想以编程方式调用popover segue时,必须分两步执行:
1.将Segue连接到ViewController您只需从应执行segue的ViewController拖动到目标ViewController并选择Popover.

2.定义标识符这是调用代码执行segue所必需的
3.连接锚点您可以将锚点拖动到要从中开始弹出窗口的对象.在下图中,它是一个BarButtonItem.注意:这不会自动执行segue!(这样你还可以执行一些连接到BarButtonItem的动作)

4.从您的代码中调用segue
[self performSegueWithIdentifier:@"yourIdentifier" sender:sender];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2254 次 |
| 最近记录: |