我有桌子从json得到一些东西 我选择行的索引我要打开其他控件 和其他控件获得第一个varbiles 想象代码 但是在代码中尝试从tableview发送到seque但是在seque中没有任何代码发生错误 我想从桌子上拿到网址
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath:
IndexPath)
{
// let selectedEpisode = self.episodes[(indexPath as NSIndexPath).row]
self.performSegue(withIdentifier: "videoplay", sender: indexPath);
}
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
cell.alpha = 0
let transform = CATransform3DTranslate(CATransform3DIdentity, -250, 20, 0)
cell.layer.transform = transform
UIView.animate(withDuration: 1.0) {
cell.layer.transform = CATransform3DIdentity
cell.alpha = 1
}
}
func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "videoplay" {
if let indexPath = self.tableView.indexPathForSelectedRow {
let selectedEpisode = self.episodes[(indexPath as NSIndexPath).row]
let yosrihh = selectedEpisode.url! as URL
let destination = segue.destination as! videoPlayViewController
destination.urll = yosrihh
}
}
}
答案 0 :(得分:2)
问题在于,在Swift 3 prepareForSegue(:sender:)
中更改为prepare(for:sender:)
,因此只需更改此方法,然后全部设置为。
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
//Your code
}