ユーザーがセルをクリックすると別のviewControllerが開き、テーブルビューにuisearchcontroller
を追加するだけのアプリケーションがあります。didSelectRowAtIndexPath uisearchcontrollerを使用したインデックスパス
テーブルビューで検索すると、結果は正しく表示されますが、 ですが、フィルタリング後にセルをクリックすると、間違ったページが開きます。
私の問題はuiviewcontroller
が結果オープン正しいページを作成するアクティブなときに、私は今、どのように
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
IndexPathRow = indexPath.row
performSegueWithIdentifier("toView2", sender: self)
}
indexpath
を識別することはありませんです編集
私は新しいを追加することによって、私の問題を解決しました変数を整数型の構造体に格納してからdidSelectRowAtIndexPath関数を
に変更します。func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if resultSearchController.active && resultSearchController.searchBar.text != ""{
IndexPathRow = filteredData[indexPath.row].i
}
else {
IndexPathRow = indexPath.row
}
performSegueWithIdentifier("toView2", sender: self)
}
詳細を入力する必要があります。さまざまなセルにあるもの(セル情報の配列のようなもの)を格納するためのある種のメソッドが必要です。次に、行は、配列内のその場所に位置する要素に対応することができます。 – Kendel