2016-11-16 18 views
0

我創建了一個視圖控制器的自定義警報,下面這個問題的最投票回答的準則: https://stackoverflow.com/a/37275840/6196609斯威夫特警報自定義放映和分配

我用它來顯示警報,它被用作「裝載」。

let pending = UIAlertController() 

override func viewDidLoad() { 
    super.viewDidLoad() 

    […] 

    let storyboard = UIStoryboard(name: "Main", bundle: nil) 
    let pending = storyboard.instantiateViewControllerWithIdentifier("alertaLoad") 
    pending.modalPresentationStyle = UIModalPresentationStyle.OverCurrentContext 
    pending.modalTransitionStyle = UIModalTransitionStyle.CrossDissolve 

    […] 

} 

顯示:

self.presentViewController(self.pending, animated: true, completion: nil) 

我成功展示了它,但我需要用我的進程結束後調用它的視圖 - 控制,不能自行終止它是在做我引用的例子。 我試過這個,但沒有任何反應。

self.pending.dismissViewControllerAnimated(false, completion: { (vetor) -> Void in 
        […] 
       }) 

我怎麼能正確地做到這一點?

回答

2

呼叫dismiss上呈現UIViewController,不上呈現的一個:

self.dismiss(animated: true) { 
    // go on 
}