ios - Custom Cell for UISearchController -
I'm trying (but not in) a custom style for a UISearchController
Cell Defines it. By running the code below, EXC_BAD_INSTRUCTION
error cell.textlabel? .text
shows results in the line. Am I completely forgetting something here?
function table view (table view: UITableView, cellularright indexPath index: NSIndexPath) - & gt; UITableViewCell {var cell = tableView.dequeueReusableCellWithIdentifier ("cell") as UITableViewCell! If (cell = zero!) {Cell = UITableViewCell (style: UITableViewCellStyle.Value1, reuseIdentifier: "cell")} if (tableView == self.searchDisplayController .searchResultsTableView?) {The data: AnyObject = self.searchResults.objectAtIndex (indexPath Krow) as AnyObject println ( "Search results: \ (data) as") cell.textLabel .text = data.valueForKeyPath ( "name")? String cell.detailTextLabel? .text = data.valueForKeyPath ("Placemark") as? String} return cell}
If you are a cell dequeuing with the identifier "cell "No matter what. Instead, first check that which table you are looking for, if necessary, separate a separate cell (with a different identifier).
Comments
Post a Comment