【问题标题】:UITabBarController With Unwind Segue In Swift Not WorkingSwift中带有Unwind Segue的UITabBarController不起作用
【发布时间】:2015-06-09 02:10:08
【问题描述】:

通过多次搜索,我发现在实现 UITabBarController 时展开转场存在错误是一个常见问题。

我创建了一个带有两个视图的简单 UITabBarController。视图 A 和视图 B。

我按照以下说明操作:Unwind Segue not working in iOS 8

将自定义类添加到 UITabBarController 并使用它的解决方案:

CustomTabBarController.swift

import UIKit

class CustomTabBarController: UITabBarController {

override func viewControllerForUnwindSegueAction(action: Selector, fromViewController: UIViewController, withSender sender: AnyObject?) -> UIViewController? {
    var resultVC = self.selectedViewController?.viewControllerForUnwindSegueAction(action, fromViewController: fromViewController, withSender: sender)
    return resultVC
    }

}

我已经在视图 B 上连接了一个简单的按钮,以将字符串传递给视图 A。我还在将 unwind segue 连接到 Exit 时给了它一个标识符,并使用该特定标识符设置了 preparForSegue。我正在运行 Xcode 6.2。

它仍然不能像其他人那样正常工作。我已经让 segue 在不使用 UITabBarController 的情况下使用相同的代码正常工作。使用 UITabBarController 时,我单击与 Exit 关联的按钮,没有任何反应,甚至没有错误。

如有任何见解,我们将不胜感激。

谢谢

【问题讨论】:

    标签: ios swift uitabbarcontroller unwind-segue


    【解决方案1】:

    我遇到了同样的问题,马克。如果您执行 segue,使用“模态”演示而不是“显示”,问题就会得到解决。

    Segue : 以模态方式呈现, 演示文稿:当前上下文

    您的问题将得到解决。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-10-01
      • 2014-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-09
      相关资源
      最近更新 更多