Wednesday 21 February 2018

Alert View Controller - Swift

Alert View Controller - Swift

func alertMsg(viewController:UIViewController,title:String,message:String) {
    let alertController = UIAlertController(title: title, message: message, preferredStyle:UIAlertControllerStyle.alert)
    alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
    viewController.present(alertController, animated: true, completion: nil)
}

func displayAlertMessage()
{
    let alertController = UIAlertController(title: "Project Name", message: "Image has been uploaded", preferredStyle: .alert)
    let OKAction = UIAlertAction(title: "OK", style: .default) { (action:UIAlertAction!) in
        // Code in this block will trigger when OK button tapped.
        print("Ok button tapped");
self.navigationController?.backToViewController(viewController: IncidentObservationVC.self)
    }
    alertController.addAction(OKAction)
    self.present(alertController, animated: true, completion:nil)
}

No comments: