I am trying to send a link over another view when a select a row in UITableView
.
When I select the row I can see the link is printed however, the value does not get to the function prepareForSegue
.
It seems like the prepareForSegue
function is called before the selection row in UITableView
.
var videouserPath = ""
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
videouserPath = self.arrayUserVideo[indexPath.row][4]
print("tableview: ----\(videouserPath)")
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
print("segue: ----\(videouserPath)")
if segue.identifier == "toUserVideo"
{
if let destinationVC = segue.destinationViewController as? GetVideo_ViewController{
destinationVC.videoToDisplay = videouserPath
}
}
}
I got in debug:
segue: ----
tableview: ----https://example.com/resources/1361929513_02-02-2016_125830.mov
Why is the segue function called before selection?