セルをタップした時に隣のセルに移動するようにしたいです。
import UIKit class TableViewController: UITableViewController { var names: [String] = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" ] override func viewDidLoad() { super.viewDidLoad() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } // MARK: - Table view data source override func numberOfSections(in tableView: UITableView) -> Int { // #warning Incomplete implementation, return the number of sections return 0 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { // #warning Incomplete implementation, return the number of rows return names.count } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "NameCell", for: indexPath) cell.textLabel?.text = names[indexPath.row] return cell }
とTableViewController.swiftにコードを書きました。
Main.storyboardの状態は
のようになっています。TableViewの1列目・2列目・3列目と書いてあるところをタップするとその右側のTableViewに移動するようにしたいです。が、今タップしても何も動きません。
どのようにしてそれを直せば良いのでしょうか?
TableViewが結合出来ない、みたいなタイトルの質問をされてたと思うのですがこの質問内容を見る限り解決されたようですね。であれば前回の質問に対する解決方法を回答に書きましょう。