티스토리 뷰

[Swift] Notebook

Swift - Alert 만들기

Dev2DHs 2016. 4. 19. 15:15
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
//ViewController
 
import UIKit
 
class ViewController: UIViewController {
 
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }
 
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    @IBAction func buttonTapped(sender: AnyObject) {
   // alertView를 삽입
        var alertView = UIAlertController(title: "Stop! SmartPhone!", message: "D.N.U!", preferredStyle: UIAlertControllerStyle.Alert)
        // alertview에 확인버튼 삽입
        alertView.addAction(UIAlertAction(title: "return", style: UIAlertActionStyle.Default, handler: nil))
        
        // 현재 viewcontroller에 추가하기
        self.presentViewController(alertView, animated: true, completion: nil)
    }
 
}
 
 
cs


댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
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
글 보관함