0
上的一個按鈕的推動下,我有一個子視圖開始使用播放視頻如下:如何重置子視圖?
@IBAction func cardboardButton(_ sender: UIButton) {
if let button = self.videoVRView.subviews[2] as? UIButton {
button.sendActions(for: .touchUpInside)
}
}
which works like a charm, it launche a specific video player.
如果退出thtat子視圖,我還想將其復位。此刻,如果我相當子視圖,然後重新啓動它,它會從我離開它的位置開始播放視頻。我需要重置子視圖基本上使重新從0
我嘗試了視頻如下:
@IBAction func cardboardButton(_ sender: UIButton) {
if let button = self.videoVRView.subviews[2] as? UIButton {
button.sendActions(for: .touchUpInside)
let parent = self.videoVRView.subviews[2]
self.videoVRView.removeFromSuperview()
self.videoVRView = nil
parent?.addSubview(self.videoVRView)
}
}
沒有任何成功...
沒有任何人有任何建議嗎?