-
Notifications
You must be signed in to change notification settings - Fork 294
Expand file tree
/
Copy pathViewController.swift
More file actions
75 lines (54 loc) · 2.73 KB
/
Copy pathViewController.swift
File metadata and controls
75 lines (54 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//
// ViewController.swift
// SweetAlert
//
// Created by Codester on 11/3/14.
// Copyright (c) 2014 Codester. All rights reserved.
//
import UIKit
import SweetAlert
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.view.backgroundColor = UIColor(red: 242.0/255.0, green: 244.0/255.0, blue: 246.0/255.0, alpha: 1.0)
}
override func viewDidAppear(animated: Bool) {
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func aBasicMessageAlert(sender: AnyObject) {
SweetAlert().showAlert("Here's a message!")
}
@IBAction func subtitleAlert(sender: AnyObject) {
SweetAlert().showAlert("Here's a message!", subTitle: "It's pretty, isn't it?", style: AlertStyle.None)
}
@IBAction func sucessAlert(sender: AnyObject) {
SweetAlert().showAlert("Good job!", subTitle: "You clicked the button!", style: AlertStyle.Success)
}
@IBAction func warningAlert(sender: AnyObject) {
SweetAlert().showAlert("Are you sure?", subTitle: "You file will permanently delete!", style: AlertStyle.Warning, buttonTitle:"Cancel", buttonColor:UIColor.colorFromRGB(0xD0D0D0) , otherButtonTitle: "Yes, delete it!", otherButtonColor: UIColor.colorFromRGB(0xDD6B55)) { (isOtherButton) -> Void in
if isOtherButton == true {
print("Cancel Button Pressed", terminator: "")
}
else {
SweetAlert().showAlert("Deleted!", subTitle: "Your imaginary file has been deleted!", style: AlertStyle.Success)
}
}
}
@IBAction func cancelAndConfirm(sender: AnyObject) {
SweetAlert().showAlert("Are you sure?", subTitle: "You file will permanently delete!", style: AlertStyle.Warning, buttonTitle:"No, cancel plx!", buttonColor:UIColor.colorFromRGB(0xD0D0D0) , otherButtonTitle: "Yes, delete it!", otherButtonColor: UIColor.colorFromRGB(0xDD6B55)) { (isOtherButton) -> Void in
if isOtherButton == true {
SweetAlert().showAlert("Cancelled!", subTitle: "Your imaginary file is safe", style: AlertStyle.Error)
}
else {
SweetAlert().showAlert("Deleted!", subTitle: "Your imaginary file has been deleted!", style: AlertStyle.Success)
}
}
}
@IBAction func customIconAlert(sender: AnyObject) {
SweetAlert().showAlert("Sweet!", subTitle: "Here's a custom image.", style: AlertStyle.CustomImag(imageFile: "thumb.jpg"))
}
}