1
私は問題を抱えています。テーブルセルSegueWayが動作しない - SWIFT
私がセルをクリックすると、別のページに行きたい、segueWay接続とその他すべてを作成しました。
しかし、これをシミュレータで実行しても機能しない場合は、何も起こらないセルをクリックしてください。
のtableViewコード:
import UIKit
class TableViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 2
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "LabelCell")
cell.textLabel?.text="conteudo da linha"
cell.detailTextLabel?.text = "Details"
return cell
}
/* func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
tableView.deselectRowAtIndexPath(indexPath, animated: false)
}*/
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
print("Hello")
if (segue.identifier == "testing"){
let vc = (segue.destinationViewController as! EditarController)
}
}
}
これは、tableviewの行をタップすると呼び出される関数 –