[Swift] Notebook

Swift - 버튼으로 URL열기 및 전화,문자,메일 열기

Dev2DHs 2016. 4. 18. 16:14
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
//ViewController
 
 
import UIKit
 
class ViewController: UIViewController {
    
    @IBAction func OpenURL(sender: AnyObject) {
    
        var thirdURL : NSURL = NSURL(string: "http://www.google.com")!
        
        //전화 - tell://번호
        //문자 - sms://번호
        //메일 - mailto://메일주소
        
        UIApplication.sharedApplication().openURL(thirdURL)
        
        
        
        
    }
 
    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.
    }
 
 
}
 
 
cs