我實現了一個NFXRipple單元,但現在單元格不會延續到下一個表格視圖。這裏是我的cellForRowAtIndexPath
:如何修復UITableViewCell segue
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: NFXRippleCell = NFXRippleCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell")
cell.textLabel?.text = aSport[indexPath.row].name
cell.backgroundColor = UIColor.whiteColor()
cell.textLabel?.font = UIFont(name: "HelveticaNeue", size: 16)
cell.textLabel?.textColor = UIColor.blackColor()
return cell
}
和我prepareForSegue
:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let cell = sender as! NFXRippleCellN
let row = tableView.indexPathForCell(cell)?.row
let detail = segue.destinationViewController as! SecondTableViewController
detail.selectedSport = aSport[row!]
}
我應該怎麼調整?或者有什麼我失蹤?
UPDATE:這是何典在我的控制器:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: NFXRippleCell = NFXRippleCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell")
cell.textLabel?.text = aSportl[indexPath.row].name
cell.textLabel?.text = aSport[indexPath.row].name
cell.backgroundColor = UIColor.clearColor()
cell.textLabel?.font = UIFont(name: "HelveticaNeue-Thin", size: 16)
cell.textLabel?.textColor = UIColor.whiteColor()
return cell
}
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { performSegueWithIdentifier("firstSports", sender: self.tableView(tableView, cellForRowAtIndexPath: indexPath)) }
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let cell = sender as! NFXRippleCell
let row = tableView.indexPathForCell(cell)?.row
let detail = segue.destinationViewController as! SecondTableViewController
detail.selectedSchool = aSport[row!]
}
這可能是一個愚蠢的問題,但segue存在嗎? 'prepareForSegue'是否被稱爲? – dmarsi
呵呵?我不明白@dmarsi –
在''prepareForSegue'函數中,您在'NFXRippleCellN'中投送了發件人,這是否正常? – Mindsers