Skip to content

Instantly share code, notes, and snippets.

@gfelot
Created March 29, 2016 03:31
Show Gist options
  • Save gfelot/30436d05703b578c6e7d to your computer and use it in GitHub Desktop.
Save gfelot/30436d05703b578c6e7d to your computer and use it in GitHub Desktop.
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let indexPath = tableView.indexPathForSelectedRow!
let currentCell = tableView.cellForRowAtIndexPath(indexPath) as! BookTableViewCell
titleToEdit = currentCell.titleLabel.text!
labelToEdit = currentCell.subtitleLabel.text!
funcNb = indexPath.row
deselectAllRows()
performSegueWithIdentifier("editRow", sender: nil)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
//Set book view controller as delegate to scan book view controller
if segue.destinationViewController is ScanBookViewController{
let scanBookViewController:ScanBookViewController = segue.destinationViewController as! ScanBookViewController
scanBookViewController.delegate = self
} else if segue.identifier == "editRow" {
let vc = segue.destinationViewController as! EditionViewController
print(titleToEdit)
print(labelToEdit)
print(funcNb)
vc.textEdition.text = "toto" // ICI
vc.labelEdition.text = labelToEdit
vc.funcNb = funcNb
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment