How Would I Create a UIAlertview in Swift ?

/*Declare*/

  let MessageBox = UIAlertController(title: “Notice”, message: “Do you want to leave ?”, preferredStyle:.Alert)

/*Prepare*/       

        MessageBox.addAction(UIAlertAction(title: “Yes”, style: UIAlertActionStyle.Default, handler:

            {    /*Action Zone*/

                (action) in  self.dismissVC()

            }

            ))

        MessageBox.addAction(UIAlertAction(title: “No”, style: UIAlertActionStyle.Cancel, handler: nil ))

/*Move Move Move*/    

          self.presentViewController(MessageBox, animated: true, completion:nil)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: