質問編集履歴
4
FirstViewControllerのコードを修正しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -50,6 +50,30 @@
|
|
50
50
|
|
51
51
|
|
52
52
|
|
53
|
+
//追記箇所
|
54
|
+
|
55
|
+
//身長もしくは体重に何も入力されていない場合(エラー)
|
56
|
+
|
57
|
+
if height == nil || weight == nil
|
58
|
+
|
59
|
+
{
|
60
|
+
|
61
|
+
Error.text = "正常に値が入力されていないため\n計算できません。\n再入力してください。"
|
62
|
+
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
//身長が80cm以下or220cm以上、体重が20kg以下or300kg以上(異常数値を弾く処理)
|
68
|
+
|
69
|
+
else if height! <= 80 || height! >= 220 || weight! <= 20 || weight! >= 300{
|
70
|
+
|
71
|
+
Error.text = "規定の範囲外のため\n計算できません。\n再入力してください。"
|
72
|
+
|
73
|
+
}
|
74
|
+
|
75
|
+
|
76
|
+
|
53
77
|
//後々結果画面のテキストへ代入するBMI値や肥満度を代入する変数の宣言
|
54
78
|
|
55
79
|
var Ca:String!
|
3
FirstViewControllerのコードを修正しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -86,23 +86,23 @@
|
|
86
86
|
|
87
87
|
//SecondViewControllerの
|
88
88
|
|
89
|
-
func prepare(for segue: UIStoryboardSegue, sender: Any?){
|
89
|
+
override func prepare(for segue: UIStoryboardSegue, sender: Any?){
|
90
|
-
|
90
|
+
|
91
|
-
let Second
|
91
|
+
let Second = segue.destination as! SecondViewController
|
92
92
|
|
93
93
|
//BMI値等算出された値を渡す
|
94
94
|
|
95
|
-
Second
|
95
|
+
Second.Cal = Ca
|
96
|
-
|
96
|
+
|
97
|
-
Second
|
97
|
+
Second.Sta = St
|
98
|
-
|
98
|
+
|
99
|
-
Second
|
99
|
+
Second.Adv = Ad
|
100
|
-
|
100
|
+
|
101
|
-
Second
|
101
|
+
Second.StaWei = StWe
|
102
|
-
|
102
|
+
|
103
|
-
Second
|
103
|
+
Second.Ide = Id
|
104
|
-
|
104
|
+
|
105
|
-
Second
|
105
|
+
Second.Met = Me
|
106
106
|
|
107
107
|
}
|
108
108
|
|
2
FirstViewControllerのコードを修正しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -104,8 +104,6 @@
|
|
104
104
|
|
105
105
|
SecondViewController.Met = Me
|
106
106
|
|
107
|
-
}
|
108
|
-
|
109
107
|
}
|
110
108
|
|
111
109
|
|
1
FirstViewControllerのコードを修正しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -76,42 +76,36 @@
|
|
76
76
|
|
77
77
|
//
|
78
78
|
|
79
|
+
|
80
|
+
|
79
|
-
|
81
|
+
present(SecondViewController, animated: true, completion: nil)
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
}
|
80
86
|
|
81
87
|
//SecondViewControllerの
|
82
88
|
|
83
89
|
func prepare(for segue: UIStoryboardSegue, sender: Any?){
|
84
90
|
|
85
|
-
|
91
|
+
let SecondViewController = segue.destination as! SecondViewController
|
86
|
-
|
92
|
+
|
87
|
-
|
93
|
+
//BMI値等算出された値を渡す
|
88
|
-
|
94
|
+
|
89
|
-
|
95
|
+
SecondViewController.Cal = Ca
|
90
|
-
|
96
|
+
|
91
|
-
|
97
|
+
SecondViewController.Sta = St
|
92
|
-
|
98
|
+
|
93
|
-
|
99
|
+
SecondViewController.Adv = Ad
|
94
|
-
|
100
|
+
|
95
|
-
|
101
|
+
SecondViewController.StaWei = StWe
|
96
|
-
|
102
|
+
|
97
|
-
|
103
|
+
SecondViewController.Ide = Id
|
98
|
-
|
104
|
+
|
99
|
-
|
105
|
+
SecondViewController.Met = Me
|
100
106
|
|
101
107
|
}
|
102
108
|
|
103
|
-
|
104
|
-
|
105
|
-
//画面の遷移
|
106
|
-
|
107
|
-
let storyboard: UIStoryboard = self.storyboard!
|
108
|
-
|
109
|
-
let nextView = storyboard.instantiateViewController(withIdentifier: "SecondView")
|
110
|
-
|
111
|
-
present(nextView, animated: true, completion: nil)
|
112
|
-
|
113
|
-
}
|
114
|
-
|
115
109
|
}
|
116
110
|
|
117
111
|
|