回答編集履歴

2

修正

2016/07/05 16:05

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -12,6 +12,8 @@
12
12
 
13
13
  class ViewController: UIViewController {
14
14
 
15
+ let sub = Sub()
16
+
15
17
 
16
18
 
17
19
  override func viewDidLoad() {
@@ -20,7 +22,7 @@
20
22
 
21
23
 
22
24
 
23
- Sub().alert(self)
25
+ sub.alert(self)
24
26
 
25
27
  }
26
28
 
@@ -28,9 +30,9 @@
28
30
 
29
31
 
30
32
 
31
- class Sub: UIViewController {
33
+ class Sub: UIViewController {
32
34
 
33
-
35
+
34
36
 
35
37
  func alert(viewController: UIViewController) {
36
38
 

1

修正

2016/07/05 16:05

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -1,3 +1,7 @@
1
+ `presentViewController`はアラートを表示する`ViewController`のオブジェクトが必要なので、引数で渡しています。
2
+
3
+
4
+
1
5
  とりあえず以下の様にすることで呼び出すことはできます。
2
6
 
3
7