回答編集履歴
1
追記
test
CHANGED
@@ -3,3 +3,53 @@
|
|
3
3
|
|
4
4
|
|
5
5
|
[こっちからの通知を受けてみて。UIScene/willEnterForegroundNotification](https://developer.apple.com/documentation/uikit/uiscene/3197925-willenterforegroundnotification)
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
---
|
10
|
+
|
11
|
+
追記
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
```swift
|
16
|
+
|
17
|
+
import UIKit
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
class ViewController: UIViewController {
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
override func viewDidLoad() {
|
26
|
+
|
27
|
+
super.viewDidLoad()
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
NotificationCenter.default.addObserver(self,
|
32
|
+
|
33
|
+
selector: #selector(viewWillEnterForeground(_:)),
|
34
|
+
|
35
|
+
name: UIScene.willEnterForegroundNotification,
|
36
|
+
|
37
|
+
object: nil)
|
38
|
+
|
39
|
+
}
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
@objc func viewWillEnterForeground(_ notification: Notification?) {
|
44
|
+
|
45
|
+
print("viewWillEnterForeground")
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
```
|