2015-04-04 75 views
0

通過做幾次搜索,我發現在實現UITabBarController時unwind segues有問題是一個常見問題。UITabBarController With Unwind Segue在Swift中不起作用

我用兩個視圖創建了一個簡單的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.當鉤住它時,我還給了展開順序一個標識符,並用該特定標識符設置了preparForSegue。我正在運行Xcode 6.2。

它仍然沒有正常工作,因爲它爲其他人。我已經得到了segue使用相同的代碼正確工作,而不使用UITabBarController。在使用UITabBarController時,我單擊與Exit關聯的按鈕,沒有任何反應,甚至沒有發生錯誤。

請感謝您的任何見解。

謝謝

回答

1

我有同樣的問題馬克。如果您使用「Modal」演示文稿而不是「Show」執行搜索,則問題得到解決。

Segue公司:目前有模式, 介紹:現實語境

而且你的問題將得到解決。

相關問題