回答編集履歴
3
追記
test
CHANGED
@@ -85,3 +85,13 @@
|
|
85
85
|
}
|
86
86
|
|
87
87
|
```
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
ボタンの接続確認
|
92
|
+
|
93
|
+
---
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
![image](de22305d81d27d002fd26dd9fcfa24f3.png)
|
2
追記
test
CHANGED
@@ -14,9 +14,51 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
参考
|
18
17
|
|
19
18
|
|
19
|
+
こちらで試したコードは以下になります。
|
20
|
+
|
21
|
+
Xcode7.3, iPhone6s iOS9.3.1
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
```swift
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
import UIKit
|
30
|
+
|
31
|
+
import AudioToolbox
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
class ViewController: UIViewController {
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
override func viewDidLoad() {
|
40
|
+
|
41
|
+
super.viewDidLoad()
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
@IBAction func push(sender: UIButton) {
|
50
|
+
|
51
|
+
AudioServicesPlaySystemSound(UInt32(kSystemSoundID_Vibrate))
|
52
|
+
|
53
|
+
}
|
54
|
+
|
55
|
+
}
|
56
|
+
|
57
|
+
```
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
参考
|
20
62
|
|
21
63
|
★ System Sound
|
22
64
|
|
1
追記
test
CHANGED
@@ -11,3 +11,35 @@
|
|
11
11
|
}
|
12
12
|
|
13
13
|
```
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
参考
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
★ System Sound
|
22
|
+
|
23
|
+
[AudioServices](http://iphonedevwiki.net/index.php/AudioServices)
|
24
|
+
|
25
|
+
```swift
|
26
|
+
|
27
|
+
import AudioToolbox
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
@IBAction func play(sender: UIButton) {
|
32
|
+
|
33
|
+
// Sound
|
34
|
+
|
35
|
+
AudioServicesPlaySystemSound(UInt32(1001))
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
// Vibration
|
40
|
+
|
41
|
+
AudioServicesPlaySystemSound(UInt32(kSystemSoundID_Vibrate))
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
```
|