I have an UITableView
with a custom cell that triggers a segue when selected. No problems there. I also have a search bar that is working fine with sorting. The problem begins when the searchDisplayController.searchResultsTableView
is displayed, and I select a cell within that. didSelectRowAtIndexPath
fires without a problem.
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
self.performSegueWithIdentifier("details", sender: self)
}
which then fires performSegueWithIdentifier
without a hitch
override func performSegueWithIdentifier(identifier: String?, sender: AnyObject?) {
println("Perform segue fired")
}
However, prepareForSegue
is never called.
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "doneSegue" {
println("Done Segue")
}
if segue.identifier == "details" {
if let destinationVC = segue.destinationViewController as? CoffeeDetailViewController {
if let index = self.journalTable.indexPathForSelectedRow() {
// Sets an object to hold the contents of the specific cell that was tapped
let parametersForRow = coffeeEntry[index.row]
let attributes: Dictionary = parametersForRow.entity.attributesByName as Dictionary
let parameterDictionary: Dictionary = parametersForRow.dictionaryWithValuesForKeys(attributes.keys.array)
println("Parameters: \(parametersForRow)")
destinationVC.parameterDictionary = parameterDictionary
}
}
}
}
I have a feeling I'm making a rookie mistake and I'm just not seeing something. Any ideas?
EDIT: I forgot a really important piece of information. I'm using the custom cell for the searchDisplayController.searchResultsTableView
with a nib outside of storyboard. I register the nib in viewDidLoad
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.leftBarButtonItem?.title = "Back"
var nib = UINib(nibName: "CoffeeTableViewCell", bundle: nil)
searchDisplayController?.searchResultsTableView.registerNib(nib, forCellReuseIdentifier: cellIdentifier)
}