korhan-Ö
11/5/2016 - 8:16 AM

#Alert

let alert = UIAlertController(title: "Delete Planet", message: "Are you sure you want to permanently delete sadf?", preferredStyle: .ActionSheet)
                
                let DeleteAction = UIAlertAction(title: "Delete", style: .Destructive, handler: nil)
                let CancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: nil)
                
                alert.addAction(DeleteAction)
                alert.addAction(CancelAction)
                
                // Support display in iPad
                alert.popoverPresentationController?.sourceView = self.view
                alert.popoverPresentationController?.sourceRect = CGRectMake(self.view.bounds.size.width / 2.0, self.view.bounds.size.height / 2.0, 1.0, 1.0)
                
                self.presentViewController(alert, animated: true, completion: nil)
func alertViewGosterWithActionButton (titleText:String, messageText:String, 
        actionTitleText:String, fonksiyon:()) {
        var alertController = UIAlertController(title: titleText, message: messageText, preferredStyle: .Alert)
        
        // Create the actions
        var okAction = UIAlertAction(title: actionTitleText, style: UIAlertActionStyle.Default) {
            UIAlertAction in
            fonksiyon
        }
        
        alertController.addAction(okAction)
        self.presentViewController(alertController, animated: true, completion: nil)

    }
    func alertViewGoster (titleText:String, messageText:String, actionTitleText:String) {
        var alertController = UIAlertController(title: titleText, message: messageText, preferredStyle: .Alert)
        
        // Create the actions
        alertController.addAction(UIAlertAction(title: actionTitleText, 
            style: UIAlertActionStyle.Default, handler: nil))
        
        // Present the controller
        self.presentViewController(alertController, animated: true, completion: nil)

    }