thanhvoquang
12/7/2017 - 3:25 AM

[Swift] Show alert in present popup(SimpleTransitioningDelegate)

 let alert = UIAlertController(title: "Thông báo", message: "Vui lòng chọn một cửa hàng", preferredStyle: UIAlertControllerStyle.alert)
            alert.addAction(UIAlertAction(title: "Đồng ý", style: .cancel, handler: nil))
            // assuming that this is the first time your controller is presented
            present(alert, animated: true, completion: nil)
            //something bad happened and your application is trying to present the alert again, safe guard against presenting it twice by checking if presentedViewController is nil or not
            if presentedViewController == nil {
                present(alert, animated: true, completion: nil)
            }