【发布时间】:2016-05-11 11:40:06
【问题描述】:
当我在UITableView 中选择一行时,我正在尝试通过另一个视图发送链接。
当我选择行时,我可以看到打印了链接,但是该值没有到达函数prepareForSegue。
似乎在UITableView 中的选择行之前调用了prepareForSegue 函数。
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
}
}
}
我进入调试状态:
转场:----
tableview:----https://example.com/resources/1361929513_02-02-2016_125830.mov
为什么在选择之前调用segue函数?
【问题讨论】:
-
也许通过在情节提要中设置从
UIViewController而不是从UITableViewCell到GetVideo_ViewController的segue?
标签: ios uitableview segue uistoryboardsegue