Sag*_*usA 0 uibutton segue swift
在我的应用程序中,我有以下故事板片段:
从粉红色的按钮我添加了一个名为"toFishPic"的show segue到了更高的UIViewController.这是链接到粉红色按钮的快速代码:
@IBAction func toFishPhoto(sender: UIButton) {
dispatch_async(dispatch_get_main_queue()) {
self.performSegueWithIdentifier("toFishPic", sender: self)
}
}
Run Code Online (Sandbox Code Playgroud)
我不知道为什么,但是当点击粉红色按钮时,右侧的UIViewConroller(具有大UIImageView的那个)被加载两次,好像之后有一个相同.为什么会这样?
小智 5
我认为你直接将粉红色按钮链接到PhotoViewController而不是ActionFishViewController到PhotoViewController.如果您要使用performSegueWithIdentifier,请不要直接链接并重新连接控制器.
尝试不要调用self.performSegueWithIdentifier("toFishPic",sender:self)(//)并检查是否可以推送到PhotoViewController.如果它的工作意味着您将按钮直接链接到PhotoViewController.
| 归档时间: |
|
| 查看次数: |
1116 次 |
| 最近记录: |