我需要在prepareForSegue中为选定的行添加一个值,以便它执行其操作。但是我的prepareForSegue在执行其操作之前执行了操作。当我尝试放置“performSegueWithIdentifier”时,它会崩溃。我已在故事板中将id添加到segue idenfifier中。我正在使用sqlite。
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
selectedRow = indexPath.row
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if(segue.identifier == "editSegue")
{
let viewController : WorkoutView = segue.destinationViewController as! WorkoutView
viewController.workoutInfoData = marrStudentData.objectAtIndex(selectedRow) as! WorkoutInfo
navigationItem.title = ""
}
}