J'ai créé une table et un contrôleur de barre de recherche avec elle. J'ai utilisé une structure pour créer le contenu de la table. Je veux juste stocker les données dans la cellule sélectionnée dans une variable. Je suis une nouvelle aide iOS developer.please :) TIADidSelectRowAtIndexPath SWIFT
//my struct
import Foundation
struct areas
{
let name : String
}
// table contents
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = self.tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! UITableViewCell
var place :areas
if tableView == self.searchDisplayController!.searchResultsTableView{
place = filteredareas[indexPath.row]
}
else{
place = places[indexPath.row]
}
cell.textLabel!.text = place.name
cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator
return cell
}
Comment utiliser didSelectRowAtIndexPath pour connaître le contenu de la cellule vous cliquez dessus?
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableViewDelegate_Protocol/ lire –