回答編集履歴

3

2018/06/18 23:48

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -28,9 +28,11 @@
28
28
 
29
29
  ```swift
30
30
 
31
+ class circle: UIViewController, UITextFieldDelegate {
31
32
 
33
+
32
34
 
33
- class circle: UIViewController, UITextFieldDelegate {
35
+ @IBOutlet weak var myTextField: UITextField!
34
36
 
35
37
 
36
38
 
@@ -40,7 +42,7 @@
40
42
 
41
43
  if let circle2 = segue.destination as? circle2 {
42
44
 
43
- circle2.text = "abc"
45
+ circle2.text = myTextField.text ?? ""
44
46
 
45
47
  }
46
48
 

2

s

2018/06/18 23:48

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -15,3 +15,47 @@
15
15
 
16
16
 
17
17
  ③ `circle2`に`text`というプロパティが定義されていないようです、定義してください。
18
+
19
+
20
+
21
+
22
+
23
+ 回答追記
24
+
25
+ ---
26
+
27
+
28
+
29
+ ```swift
30
+
31
+
32
+
33
+ class circle: UIViewController, UITextFieldDelegate {
34
+
35
+
36
+
37
+ override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
38
+
39
+
40
+
41
+ if let circle2 = segue.destination as? circle2 {
42
+
43
+ circle2.text = "abc"
44
+
45
+ }
46
+
47
+ }
48
+
49
+ }
50
+
51
+
52
+
53
+ class circle2: UIViewController, UITextFieldDelegate {
54
+
55
+
56
+
57
+ var text:String = ""
58
+
59
+ }
60
+
61
+ ```

1

s

2018/06/18 23:42

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -1,3 +1,7 @@
1
+ 値を渡そうとしている流れはあっていると思いますが、以下の部分を確認してみてください。
2
+
3
+
4
+
1
5
  ① `prepareForSegue`は`UIViewController`を継承したクラスに記述してください。
2
6
 
3
7