2016-05-07 51 views
1

看看蘋果Resource使用showViewController()presentViewController()我似乎無法弄清楚我的問題在這裏。showViewController方法只顯示模式視圖

我想以編程方式通過執行以下操作來顯示從我的故事情節進行的viewController:

if let resultController = storyboard!.instantiateViewControllerWithIdentifier("mainTab") as? TabBarController { 
     showViewController(resultController, sender: UIBarButtonItem.self) 
    } 

這工作得很好。然而,它的表現總是模態的。從底部垂直覆蓋在屏幕頂部,像這樣:

modal display

我/我還在,我應該使用showViewController顯示沒有動畫畫面的印象......但顯然我在這裏錯過了一些我想要做的就是非模態地顯示VC。我覺得我嘗試了一切都無濟於事。

感謝您的建議提前。

回答

1

我想你想使用這樣的東西。

let storyboard = UIStoryboard(name: "Main", bundle: nil) 
let vc = storyboard.instantiateViewControllerWithIdentifier("Controller") as! UIViewController 
self.presentViewController(vc, animated: false, completion: nil) // no animation or presentation as modal because animated is false 

的關鍵是有動畫設置爲。這種方法適用於我。希望這可以幫助!

+0

夥計,你搖滾。謝謝。 –

+0

沒問題,先生! – sebenalern