回答編集履歴

4

修正

2016/11/24 00:29

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
 
9
- 以下のようにしてみてください。
9
+ ★ 参考コード
10
10
 
11
11
 
12
12
 

3

修正

2016/11/24 00:29

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -3,6 +3,10 @@
3
3
 
4
4
 
5
5
  [【Tips】iOSで輝度センサーを使う(Swift対応)](http://blog.koogawa.com/entry/2013/11/17/111304)
6
+
7
+
8
+
9
+ 以下のようにしてみてください。
6
10
 
7
11
 
8
12
 

2

修正

2016/11/24 00:28

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
File without changes

1

修正

2016/11/24 00:28

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -5,8 +5,6 @@
5
5
  [【Tips】iOSで輝度センサーを使う(Swift対応)](http://blog.koogawa.com/entry/2013/11/17/111304)
6
6
 
7
7
 
8
-
9
- 動作確認してませんが、以下のようになるかと思います。
10
8
 
11
9
  ```swift
12
10
 
@@ -30,7 +28,7 @@
30
28
 
31
29
  NotificationCenter.default.addObserver(self,
32
30
 
33
- selector: Selector(("screenBrightnessDidChange:")),
31
+ selector: #selector(self.screenBrightnessDidChange(_:)),
34
32
 
35
33
  name: NSNotification.Name.UIScreenBrightnessDidChange,
36
34
 
@@ -42,7 +40,7 @@
42
40
 
43
41
 
44
42
 
45
- func screenBrightnessDidChange(notification: Notification) {
43
+ func screenBrightnessDidChange(_ notification: Notification) {
46
44
 
47
45
  if let screen = notification.object {
48
46
 
@@ -54,6 +52,4 @@
54
52
 
55
53
  }
56
54
 
57
-
58
-
59
55
  ```