回答編集履歴

2

コメントの消し忘れ

2017/04/21 06:29

投稿

退会済みユーザー
test CHANGED
@@ -1,6 +1,4 @@
1
1
  ```Swift
2
-
3
- //Pushで遷移する場合
4
2
 
5
3
  let next = storyboard?.instantiateController(withIdentifier: "ViewController2")
6
4
 

1

OSXアプリ

2017/04/21 06:29

投稿

退会済みユーザー
test CHANGED
@@ -2,34 +2,8 @@
2
2
 
3
3
  //Pushで遷移する場合
4
4
 
5
- let nextWindow = storyboard?.instantiateViewController(withIdentifier: "次のウィンドウのIdentifier")
5
+ let next = storyboard?.instantiateController(withIdentifier: "ViewController2")
6
6
 
7
- navigationController?.pushViewController(nextWindow!, animated: true)
7
+ self.presentViewControllerAsModalWindow(next! as! NSViewController)
8
-
9
-
10
-
11
- //Pushで遷移する場合(変数を渡したい時)
12
-
13
- let nextWindow = storyboard?.instantiateViewController(withIdentifier: "次のウィンドウのIdentifier") as! /* 次のウィンドウのクラス */
14
-
15
- /* ここで値を渡したり */
16
-
17
- navigationController?.pushViewController(nextWindow, animated: true)
18
8
 
19
9
  ```
20
-
21
-
22
-
23
- ```Swift
24
-
25
- //Modalの場合
26
-
27
- let nextWindow = storyboard?.instantiateViewController(withIdentifier: "次のウィンドウのIdentifier")
28
-
29
- present(nextWindow!, animated: true, completion: nil)
30
-
31
- ```
32
-
33
-
34
-
35
- やりたいことはこれであっていますかね?