这段代码很快2
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let playerViewController = segue.destination as! PlayerViewController
playerViewController.videoID = channelsDataArray[selectedVideoIndex]["videoID"] as! String
}
错误 "方法不会覆盖其超类"
中的任何方法请快速解决方案3
答案 0 :(得分:26)
在Swift 3中,它是prepare(for:sender:)
,第二个参数是Any
:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let playerViewController = segue.destination as! PlayerViewController
playerViewController.videoID = channelsDataArray[selectedVideoIndex]["videoID"] as! String
}
将来,如果您暂时注释掉您的方法并开始输入prepare
,代码完成将显示正确的方法签名。