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

質問編集履歴

1

コードを見やすく修正しました。

2015/10/03 02:09

投稿

c8h14
c8h14

スコア12

title CHANGED
File without changes
body CHANGED
@@ -101,20 +101,14 @@
101
101
 
102
102
  // MARK: - TableView
103
103
  func settingFareTableView(){
104
-
105
- print("settingFareTableView")
106
-
107
104
  fareTableView = UITableView(frame: CGRectMake(0, 512, 320, CGFloat(60 * fares.count)))
108
105
 
109
- // Cell名の登録をおこなう.
106
+ // Cell名の登録をおこなう.
110
- fareTableView!.registerClass(UITableViewCell.self, forCellReuseIdentifier: "FareCell")
107
+ fareTableView!.registerClass(UITableViewCell.self, forCellReuseIdentifier: "FareCell")
111
-
112
108
  // DataSourceの設定をする.
113
109
  fareTableView!.dataSource = self
114
-
115
110
  // Delegateを設定する.
116
111
  fareTableView!.delegate = self
117
-
118
112
  // Viewに追加する.
119
113
  scrollView.addSubview(fareTableView!)
120
114
 
@@ -123,19 +117,13 @@
123
117
 
124
118
  func settingOptionTableView(){
125
119
 
126
- print("settingOptionTableView")
127
-
128
120
  optionTableView = UITableView(frame: CGRectMake(0, optionHight + 44, 320, CGFloat(60 * options.count)))
129
-
130
121
  // Cell名の登録をおこなう.
131
122
  optionTableView!.registerClass(UITableViewCell.self, forCellReuseIdentifier: "OptionCell")
132
-
133
123
  // DataSourceの設定をする.
134
124
  optionTableView!.dataSource = self
135
-
136
125
  // Delegateを設定する.
137
126
  optionTableView!.delegate = self
138
-
139
127
  // Viewに追加する.
140
128
  scrollView.addSubview(optionTableView!)
141
129
 
@@ -146,17 +134,10 @@
146
134
  Cellの数を返すデータソースメソッド.
147
135
  */
148
136
  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
149
-
150
- print("numberOfRowsInSection:\(options)")
151
-
152
- var cellCount = 0
137
+ var cellCount = 0
153
-
154
138
  if tableView.tag == 1{
155
-
156
139
  cellCount = fares.count
157
-
158
140
  }else if tableView.tag == 2{
159
-
160
141
  cellCount = options.count
161
142
  }
162
143
 
@@ -171,31 +152,20 @@
171
152
  */
172
153
  func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
173
154
 
174
- print("cellForRowAtIndexPath\(indexPath.row)")
175
-
176
155
  // 再利用するCellを取得する.
177
156
  // let cell = tableView.dequeueReusableCellWithIdentifier("Cell",forIndexPath:indexPath)
178
-
179
-
180
157
  var cell:UITableViewCell = UITableViewCell()
181
158
 
182
159
  if tableView.tag == 1{
183
160
 
184
161
  cell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "FareCell")
185
-
186
162
  let fare:[String] = fares[indexPath.row]
187
-
188
163
  cell.textLabel?.text = fare[0]
189
164
  cell.detailTextLabel?.text = fare[1]
190
165
 
191
166
  } else if tableView.tag == 2{
192
167
 
193
168
  cell = UITableViewCell(style: UITableViewCellStyle.Value2, reuseIdentifier: "OptionCell")
194
-
195
- // Cellに値を設定する.
196
- // let option:[String] = driverAndCar.options[indexPath.row]
197
-
198
-
199
169
  let option:[String] = options[indexPath.row]
200
170
 
201
171
  //Cellに値を設定
@@ -220,9 +190,6 @@
220
190
 
221
191
  // MARK: - Parse(optionのデータを取得する)
222
192
  func getFareDatas(companyObject:PFObject!){
223
-
224
- print("getFareDatas:\(companyObject)")
225
-
226
193
  let query = PFQuery(className: "Fare")
227
194
  query.whereKey("company", equalTo: companyObject)
228
195
  query.orderByAscending("order")
@@ -246,27 +213,16 @@
246
213
  fareDetail = object["fareDetail"] as! String
247
214
  }
248
215
 
249
-
250
216
  let fare:[String] = [title,fareDetail]
251
-
252
- self.fares.append(fare)
217
+ self.fares.append(fare)
253
-
254
-
255
- }
218
+ }
256
-
257
219
  }
258
-
259
- self.getOptionDatas(companyObject) ・・・ ※2
220
+ self.getOptionDatas(companyObject) ・・・ ※2
260
-
261
- }
221
+ }
262
-
263
222
  }
264
223
 
265
224
 
266
225
  func getOptionDatas(companyObject:PFObject!){
267
-
268
- print("getOptionDatas:\(companyObject)")
269
-
270
226
  let query = PFQuery(className: "Option")
271
227
  query.whereKey("company", equalTo: companyObject)
272
228
  query.orderByAscending("order")
@@ -283,17 +239,9 @@
283
239
  let option:[String] = [item,fare]
284
240
 
285
241
  self.options.append(option)
286
-
287
-
242
+
288
- }
243
+ }
289
-
290
244
  }
291
-
292
-
293
- }
245
+ }
294
-
295
246
  }
296
-
297
-
298
-
299
247
  }