質問編集履歴

3

説明不足だったため

2018/03/27 11:26

投稿

DynMat
DynMat

スコア12

test CHANGED
@@ -1 +1 @@
1
- Segueを用いて条件付きで画面遷移させたい。遷移前のwindow閉じい。
1
+ Segueを用いて条件付きで画面遷移させ遷移前のwindow閉じい。
test CHANGED
File without changes

2

文法ミス

2018/03/27 11:26

投稿

DynMat
DynMat

スコア12

test CHANGED
File without changes
test CHANGED
@@ -2,11 +2,15 @@
2
2
 
3
3
  ```swift
4
4
 
5
- @IBAction func InputDecide(_ sender: NSButton) {
5
+ @IBAction func InputDecide(_ sender: NSButton) {
6
6
 
7
- performSegue(withIdentifier: NSStoryboardSegue.Identifier(rawValue: "Next"), sender: nil)
7
+ if (QuestionNumber == 15) {
8
8
 
9
+ performSegue(withIdentifier:NSStoryboardSegue.Identifier(rawValue: "Next"), sen der: nil)
10
+
9
- self.view.window?.close()
11
+ self.view.window?.close()
12
+
13
+ }
10
14
 
11
15
  }
12
16
 
@@ -30,4 +34,8 @@
30
34
 
31
35
 
32
36
 
37
+ 下の画像はStoryBoardの画像です。
38
+
39
+
40
+
33
41
  回答よろしくお願いします。![StoryBoardです。](038146ca31ab86b930560a417db7aa28.png)

1

要点追加

2018/03/27 10:48

投稿

DynMat
DynMat

スコア12

test CHANGED
@@ -1 +1 @@
1
- Segueを用いて条件付きで画面遷移させたい
1
+ Segueを用いて条件付きで画面遷移させたい。遷移前のwindowが閉じない。
test CHANGED
@@ -1,26 +1,28 @@
1
- Segueを用いて条件付きで画面遷移させたいです。
1
+ Segueを用いて条件付きでボタンを押すと画面遷移し、遷移前のwindowを閉じるようにしたいです。
2
2
 
3
3
  ```swift
4
4
 
5
- if (QuestionNumber == 15) {
5
+ @IBAction func InputDecide(_ sender: NSButton) {
6
6
 
7
- sendcorrectnum = CorrectNumber.description
7
+ performSegue(withIdentifier: NSStoryboardSegue.Identifier(rawValue: "Next"), sender: nil)
8
8
 
9
- performSegue(withIdentifier: NSStoryboardSegue.Identifier(rawValue: "Next"), sender: nil)
9
+ self.view.window?.close()
10
10
 
11
- self.view.window?.close()
11
+ }
12
12
 
13
- }
13
+ ```
14
+
15
+ 上記のようにif文の中に
14
16
 
15
17
  ```
16
-
17
- 上記のようにif文の中に```
18
18
 
19
19
  performSegue(withIdentifier: NSStoryboardSegue.Identifier(rawValue: "Next"), sender: nil)
20
20
 
21
21
  ```
22
22
 
23
+ を入れたのですが、条件を満たす前に画面遷移してしまいます。また画面遷移した後に遷移前のwindowを閉じるために、```self.view.window?.close()
24
+
23
- を入れたのですが、条件を満たす前に画面遷移してしいます
25
+ ```と書いたのですが、遷移前のwindowは閉じせん
24
26
 
25
27
 
26
28
 
@@ -28,4 +30,4 @@
28
30
 
29
31
 
30
32
 
31
- 回答よろしくお願いします。
33
+ 回答よろしくお願いします。![StoryBoardです。](038146ca31ab86b930560a417db7aa28.png)