teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

3

追記

2016/04/10 05:55

投稿

_Kentarou
_Kentarou

スコア8490

answer CHANGED
@@ -41,4 +41,9 @@
41
41
  // Vibration
42
42
  AudioServicesPlaySystemSound(UInt32(kSystemSoundID_Vibrate))
43
43
  }
44
- ```
44
+ ```
45
+
46
+ ボタンの接続確認
47
+ ---
48
+
49
+ ![image](de22305d81d27d002fd26dd9fcfa24f3.png)

2

追記

2016/04/10 05:55

投稿

_Kentarou
_Kentarou

スコア8490

answer CHANGED
@@ -6,8 +6,29 @@
6
6
  }
7
7
  ```
8
8
 
9
+
10
+ こちらで試したコードは以下になります。
11
+ Xcode7.3, iPhone6s iOS9.3.1
12
+
13
+ ```swift
14
+
15
+ import UIKit
16
+ import AudioToolbox
17
+
18
+ class ViewController: UIViewController {
19
+
20
+ override func viewDidLoad() {
21
+ super.viewDidLoad()
22
+ }
23
+
24
+
25
+ @IBAction func push(sender: UIButton) {
26
+ AudioServicesPlaySystemSound(UInt32(kSystemSoundID_Vibrate))
27
+ }
28
+ }
29
+ ```
30
+
9
31
  参考
10
-
11
32
  ★ System Sound
12
33
  [AudioServices](http://iphonedevwiki.net/index.php/AudioServices)
13
34
  ```swift

1

追記

2016/04/09 13:57

投稿

_Kentarou
_Kentarou

スコア8490

answer CHANGED
@@ -4,4 +4,20 @@
4
4
  @IBAction func aaa(sender: AnyObject) {
5
5
  AudioServicesPlaySystemSound(UInt32(kSystemSoundID_Vibrate))
6
6
  }
7
+ ```
8
+
9
+ 参考
10
+
11
+ ★ System Sound
12
+ [AudioServices](http://iphonedevwiki.net/index.php/AudioServices)
13
+ ```swift
14
+ import AudioToolbox
15
+
16
+ @IBAction func play(sender: UIButton) {
17
+ // Sound
18
+ AudioServicesPlaySystemSound(UInt32(1001))
19
+
20
+ // Vibration
21
+ AudioServicesPlaySystemSound(UInt32(kSystemSoundID_Vibrate))
22
+ }
7
23
  ```