Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to show an alert view in Swift Programming Language?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 790
    Comment on it

    To show an alert in Swift programming language, you need to first import the UIKit framework then use UIAlertController object.


    A UIAlertController object displays an alert message to the user.


    Important: UIAlertView is deprecated in iOS 8. (Note that UIAlertViewDelegate is also deprecated.) To create and manage alerts in iOS 8 and later, instead use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert.


    Example:

    var MyAlert = UIAlertController(title: "My Alert Box", message: "Hi", preferredStyle: UIAlertControllerStyle.Alert)
    var MyOkayAction = UIAlertAction(title: "Okay", style: UIAlertActionStyle.Default, handler: nil)
    MyAlert.addAction(MyOkayAction)
    self.presentViewController(MyAlert, animated: true, completion: nil)
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: