
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view. | |
} | |
@IBAction func sds(_ sender: Any) { | |
showActionSheet() | |
} | |
func showAlert() { | |
let alert = UIAlertController(title: "title", message: "Hello world", preferredStyle: .alert) | |
alert.addAction(UIAlertAction(title: "Dissmiss", style: .cancel, handler: { (action) in | |
print("dismiss") | |
})) | |
present(alert, animated: true) | |
} | |
func showActionSheet() { | |
let actionSheet = UIAlertController(title: "Title", message: "Hello World", preferredStyle: .actionSheet) | |
actionSheet.addAction(UIAlertAction(title: "Dismiss", style: .cancel, handler: { (action) in | |
print("ss") | |
})) | |
actionSheet.addAction(UIAlertAction(title: "Dismiss", style: .default, handler: { (action) in | |
print("ss") | |
})) | |
actionSheet.addAction(UIAlertAction(title: "Dismiss", style: .destructive, handler: { (action) in | |
print("ss") | |
})) | |
present(actionSheet, animated: true) | |
} | |
} |
'IOS(Swift)' 카테고리의 다른 글
swift escaping (0) | 2021.05.17 |
---|---|
Swift 클로저(Closure) (0) | 2021.05.17 |
Swift costom dialog (0) | 2021.05.07 |
Swift Rating bar (0) | 2021.05.07 |
pushViewController popViewController (0) | 2021.05.06 |