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

回答編集履歴

1

追記

2020/06/29 13:06

投稿

退会済みユーザー
answer CHANGED
@@ -1,3 +1,28 @@
1
1
  [これじゃなくて、UIApplicationDelegate/willEnterForegroundNotification](https://developer.apple.com/documentation/uikit/uiapplication/1622944-willenterforegroundnotification)
2
2
 
3
- [こっちからの通知を受けてみて。UIScene/willEnterForegroundNotification](https://developer.apple.com/documentation/uikit/uiscene/3197925-willenterforegroundnotification)
3
+ [こっちからの通知を受けてみて。UIScene/willEnterForegroundNotification](https://developer.apple.com/documentation/uikit/uiscene/3197925-willenterforegroundnotification)
4
+
5
+ ---
6
+ 追記
7
+
8
+ ```swift
9
+ import UIKit
10
+
11
+ class ViewController: UIViewController {
12
+
13
+ override func viewDidLoad() {
14
+ super.viewDidLoad()
15
+
16
+ NotificationCenter.default.addObserver(self,
17
+ selector: #selector(viewWillEnterForeground(_:)),
18
+ name: UIScene.willEnterForegroundNotification,
19
+ object: nil)
20
+ }
21
+
22
+ @objc func viewWillEnterForeground(_ notification: Notification?) {
23
+ print("viewWillEnterForeground")
24
+ }
25
+
26
+ }
27
+
28
+ ```