テーブルビューをフォーム2の配列に設定するように設定しました。私はこれが正常にテーブルビューにあったが、私はそれが表示されている情報のいずれもビューコントローラに入れていませんでした。私は何が間違っていたのか分かりません。私はviewviewrollerで行ったのと同じようにviewControllerを設定しました。 行が作成され、情報が入力され、すべてのデータが入力されるまでこの行が続行されることがあります。 問題は、データが表示されていないことです。私はここで何が欠けているのか分からない。どんな助けもありがとう。viewController内のテーブルビューに情報が表示されません
これは私が持っているものです。
class MyViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
var titleDate = ["Apple", "Apricot", "Banana", "Kiwi" , "Juniperberry" , "GhostBusteres"]
var descriptionDate = ["One", "Two", "Three", "4", "5", "6"]
@IBOutlet weak var myTableView: UITableView!
// MARK: - UIViewController lifecycle
override func viewDidLoad() {
super.viewDidLoad()
myTableView.editing = true
}
// MARK: - UITableViewDataSource
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return titleDate.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Coupon", forIndexPath: indexPath) as! CouponTableViewCell
cell.couponTitle.text = titleDate[indexPath.row]
cell.couponDescription.text = descriptionDate[indexPath.row]
cell.couponAnother.text = "Like a bloody storm"
return cell
}
func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {
return .None
}
func tableView(tableView: UITableView, shouldIndentWhileEditingRowAtIndexPath indexPath: NSIndexPath) -> Bool {
return false
}
func tableView(tableView: UITableView, moveRowAtIndexPath sourceIndexPath: NSIndexPath, toIndexPath destinationIndexPath: NSIndexPath) {
let movedObject = self.titleDate[sourceIndexPath.row]
titleDate.removeAtIndex(sourceIndexPath.row)
titleDate.insert(movedObject, atIndex: destinationIndexPath.row)
descriptionDate.removeAtIndex(sourceIndexPath.row)
descriptionDate.insert(movedObject, atIndex: destinationIndexPath.row)
NSLog("%@", "\(sourceIndexPath.row) => \(destinationIndexPath.row) \(titleDate)")
// To check for correctness enable: self.tableView.reloadData()
}
}
そして私はまた、変数にラベルをリンクし、それがまた働くセルクラスを持っています。
ありがとうございました。
デリゲートとデータソースをストーリーボード –