2015-09-17 26 views

回答

0

這裏是我用來初始化警報的功能:

func displayAlert(title: String, message: String) { 
    var alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.Alert) 
    alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: { (ACTION) -> Void in 
     // self.dismissViewControllerAnimated(true, completion: nil) 
     alert.hidesBottomBarWhenPushed = true 
    })) 
    print("running Activityindicator code") 
    self.presentViewController(alert, animated: true, completion: nil) 
} 

,我叫它像這樣:

self.displayAlert("Alert title", message: "alert message") 

希望這有助於!

+0

我在哪裏可以調用displayAlert()?導致電話號碼在網絡視圖中,而不是按鈕或類似的東西 – Happiehappie

相關問題