回答編集履歴

1

訂正

2020/04/21 10:25

投稿

退会済みユーザー
test CHANGED
@@ -20,6 +20,8 @@
20
20
 
21
21
  super.viewDidLoad()
22
22
 
23
+ print("ViewController/viewDidLoad") // ②
24
+
23
25
  }
24
26
 
25
27
  }
@@ -36,22 +38,34 @@
36
38
 
37
39
  print("subVC/viewDidLoad: (String(describing: (parent as? ViewController)?.str))")
38
40
 
39
- // => nil
41
+ // => nil
40
42
 
41
43
  }
42
44
 
43
45
 
44
46
 
45
- @IBAction func btnDidTap(_ sender: Any) {
47
+ override func viewWillAppear(_ animated: Bool) {
46
48
 
47
- print("subVC/btnDidTap: (String(describing: (parent as? ViewController)?.str))")
49
+ super.viewWillAppear(animated)
48
50
 
51
+ print("subVC/viewWillAppear: (String(describing: (parent as? ViewController)?.str))")
52
+
49
- // => parent
53
+ // => parent
54
+
55
+ }
56
+
57
+
58
+
59
+ override func viewDidAppear(_ animated: Bool) {
60
+
61
+ super.viewDidAppear(animated)
62
+
63
+ print("subVC/viewDidAppear: (String(describing: (parent as? ViewController)?.str))")
64
+
65
+ // ④ => parent
50
66
 
51
67
  }
52
68
 
53
69
  }
54
70
 
55
-
56
-
57
71
  ```