今回swiftのtableviewについて質問させていただきます。
tableviewに乗り換えのデータを入れスクロールすると強制的にデータが更新されてしまう
のでそれを停止あるいはデータを変動させないようにしたいのですがご教授お願いいたします。
スクロールする際にif文の真の場合のtextが変動してしまいelse文の内容は変動しません。
なのでif文内の数値が変動しないように変更するにはどうすればいいでしょうか?
swift
1func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 2 let cell = tableboard.dequeueReusableCellWithIdentifier("table_cell", forIndexPath: indexPath) 3 4 let station_name = tableboard.viewWithTag(1) as! UILabel 5 let line_name = tableboard.viewWithTag(2) as! UILabel 6 let x = change_line[indexPath.row] 7 if(change_line[indexPath.row] == -1){ 8 station_name.text = ("↓ \(mini[change_line[indexPath.row + 1]] - mid_min)min") 9 mid_min = mini[change_line[indexPath.row + 1]] 10 line_name.text = "" 11 }else{ 12 switch(x){ 13 case start: 14 station_name.text = ("出発:\(STATION[change_line[indexPath.row]])") 15 line_name.text = transfer(change_line[indexPath.row]) 16 break 17 case goal: 18 station_name.text = ("到着:\(STATION[change_line[indexPath.row]])") 19 line_name.text = "" 20 break 21 default: 22 station_name.text = ("乗り換え:\(STATION[change_line[indexPath.row]])") 23 line_name.text = transfer(change_line[indexPath.row]) 24 break 25 } 26 } 27 return cell 28 }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/10/22 09:22
2016/10/22 14:40
2016/11/01 07:10