質問編集履歴
1
コードのタイトル変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,14 +7,8 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
|
10
|
-
###
|
10
|
+
###AppDelegate.swift
|
11
11
|
```Swift3.0
|
12
|
-
///////////////////
|
13
|
-
//
|
14
|
-
// AppDelegate.swift
|
15
|
-
//
|
16
|
-
//////////////////
|
17
|
-
|
18
12
|
import UIKit
|
19
13
|
|
20
14
|
@UIApplicationMain
|
@@ -56,14 +50,8 @@
|
|
56
50
|
}
|
57
51
|
```
|
58
52
|
|
59
|
-
###
|
53
|
+
###ViewController.swift(遷移前)
|
60
54
|
```Swift3.0
|
61
|
-
///////////////////
|
62
|
-
//
|
63
|
-
// 遷移前のViewController.swift
|
64
|
-
//
|
65
|
-
//////////////////
|
66
|
-
|
67
55
|
import UIKit
|
68
56
|
|
69
57
|
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
|
@@ -84,8 +72,8 @@
|
|
84
72
|
Cellが選択された際に呼び出される
|
85
73
|
*/
|
86
74
|
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
87
|
-
print("Num:
|
75
|
+
print("Num: (indexPath.row)")
|
88
|
-
print("Value:
|
76
|
+
print("Value: (myItems[indexPath.row])")
|
89
77
|
|
90
78
|
let storyboard: UIStoryboard = self.storyboard!
|
91
79
|
let nextView = storyboard.instantiateViewController(withIdentifier: "second") as! SecondViewController
|
@@ -112,21 +100,15 @@
|
|
112
100
|
let cell = tableView.dequeueReusableCell(withIdentifier: "MyCell", for: indexPath as IndexPath)
|
113
101
|
|
114
102
|
// Cellに値を設定する.
|
115
|
-
cell.textLabel!.text = "
|
103
|
+
cell.textLabel!.text = "(myItems[indexPath.row])"
|
116
104
|
|
117
105
|
return cell
|
118
106
|
}
|
119
107
|
}
|
120
108
|
```
|
121
109
|
|
122
|
-
###
|
110
|
+
###SecondViewController.swift(遷移後)
|
123
111
|
```Swift3.0
|
124
|
-
///////////////////
|
125
|
-
//
|
126
|
-
// 遷移後のSecondViewController.swift
|
127
|
-
//
|
128
|
-
//////////////////
|
129
|
-
|
130
112
|
import UIKit
|
131
113
|
|
132
114
|
class SecondViewController: UIViewController {
|
@@ -141,7 +123,7 @@
|
|
141
123
|
let appDelegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
|
142
124
|
let Number = appDelegate.Number
|
143
125
|
|
144
|
-
Label.text = "
|
126
|
+
Label.text = "(Number)"
|
145
127
|
}
|
146
128
|
|
147
129
|
override func didReceiveMemoryWarning() {
|