teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

説明不足だったため

2018/03/27 11:26

投稿

DynMat
DynMat

スコア12

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

2

文法ミス

2018/03/27 11:26

投稿

DynMat
DynMat

スコア12

title CHANGED
File without changes
body CHANGED
@@ -1,8 +1,10 @@
1
1
  Segueを用いて条件付きでボタンを押すと画面遷移し、遷移前のwindowを閉じるようにしたいです。
2
2
  ```swift
3
- @IBAction func InputDecide(_ sender: NSButton) {
3
+ @IBAction func InputDecide(_ sender: NSButton) {
4
+ if (QuestionNumber == 15) {
4
- performSegue(withIdentifier: NSStoryboardSegue.Identifier(rawValue: "Next"), sender: nil)
5
+ performSegue(withIdentifier:NSStoryboardSegue.Identifier(rawValue: "Next"), sen der: nil)
5
- self.view.window?.close()
6
+ self.view.window?.close()
7
+ }
6
8
  }
7
9
  ```
8
10
  上記のようにif文の中に
@@ -14,4 +16,6 @@
14
16
 
15
17
  Cocoaを使用しております。
16
18
 
19
+ 下の画像はStoryBoardの画像です。
20
+
17
21
  回答よろしくお願いします。![StoryBoardです。](038146ca31ab86b930560a417db7aa28.png)

1

要点追加

2018/03/27 10:48

投稿

DynMat
DynMat

スコア12

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