回答編集履歴

3

説明の追加

2021/10/17 02:16

投稿

-takuma
-takuma

スコア40

test CHANGED
@@ -53,3 +53,13 @@
53
53
  }
54
54
 
55
55
  ```
56
+
57
+
58
+
59
+ Story Boardの設定方法は以下のように行います。
60
+
61
+ 1.遷移先のViewControllerをクリックする
62
+
63
+ 2.Storyboard IDに「second」と入力
64
+
65
+ ![イメージ説明](ae47a9716dc45532647c8e322797323f.png)

2

書式の改善

2021/10/17 02:16

投稿

-takuma
-takuma

スコア40

test CHANGED
@@ -40,8 +40,6 @@
40
40
 
41
41
  ```swift
42
42
 
43
- alert.addAction(UIAlertAction(title: "解答する", style: .default) { _ in
44
-
45
43
  if let answer = alert.textFields?.first?.text {
46
44
 
47
45
  if answer == "(self.a + self.b)" {
@@ -54,6 +52,4 @@
54
52
 
55
53
  }
56
54
 
57
- })
58
-
59
55
  ```

1

文法の修正

2021/10/10 23:48

投稿

-takuma
-takuma

スコア40

test CHANGED
@@ -40,19 +40,15 @@
40
40
 
41
41
  ```swift
42
42
 
43
- alert.addAction(UIAlertAction(title: "解答する", style: .default) { _ in
43
+ alert.addAction(UIAlertAction(title: "解答する", style: .default) { _ in
44
44
 
45
- if let textField = alert.textFields?.first {
45
+ if let answer = alert.textFields?.first?.text {
46
-
47
- if let answer = textField.text {
48
46
 
49
47
  if answer == "(self.a + self.b)" {
50
48
 
51
49
  let secondViewController = self.storyboard?.instantiateViewController(withIdentifier: "second") as! SecondViewController
52
50
 
53
51
  self.present(secondViewController, animated: true, completion: nil)
54
-
55
- }
56
52
 
57
53
  }
58
54