回答編集履歴
3
s
answer
CHANGED
@@ -13,13 +13,14 @@
|
|
13
13
|
---
|
14
14
|
|
15
15
|
```swift
|
16
|
-
|
17
16
|
class circle: UIViewController, UITextFieldDelegate {
|
17
|
+
|
18
|
+
@IBOutlet weak var myTextField: UITextField!
|
18
19
|
|
19
20
|
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
20
21
|
|
21
22
|
if let circle2 = segue.destination as? circle2 {
|
22
|
-
circle2.text = "
|
23
|
+
circle2.text = myTextField.text ?? ""
|
23
24
|
}
|
24
25
|
}
|
25
26
|
}
|
2
s
answer
CHANGED
@@ -6,4 +6,26 @@
|
|
6
6
|
② `UIStoryboardSegue`には`destinationcircle`というプロパティはありません。`segue.destination`の間違えですね。
|
7
7
|
|
8
8
|
|
9
|
-
③ `circle2`に`text`というプロパティが定義されていないようです、定義してください。
|
9
|
+
③ `circle2`に`text`というプロパティが定義されていないようです、定義してください。
|
10
|
+
|
11
|
+
|
12
|
+
回答追記
|
13
|
+
---
|
14
|
+
|
15
|
+
```swift
|
16
|
+
|
17
|
+
class circle: UIViewController, UITextFieldDelegate {
|
18
|
+
|
19
|
+
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
20
|
+
|
21
|
+
if let circle2 = segue.destination as? circle2 {
|
22
|
+
circle2.text = "abc"
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
class circle2: UIViewController, UITextFieldDelegate {
|
28
|
+
|
29
|
+
var text:String = ""
|
30
|
+
}
|
31
|
+
```
|
1
s
answer
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
値を渡そうとしている流れはあっていると思いますが、以下の部分を確認してみてください。
|
2
|
+
|
1
3
|
① `prepareForSegue`は`UIViewController`を継承したクラスに記述してください。
|
2
4
|
|
3
5
|
|