【发布时间】:2017-10-04 14:27:24
【问题描述】:
我正在尝试在我的AVPlayerLayer 顶部添加一个播放按钮,但它没有显示出来。
我有一个名为 playerView 的 UIView 作为 IBOutlet。
以下是我如何创建player 和相应的playerLayer,并将其放入playerView:
player = AVPlayer()
superLayer = self.playerView.layer
playerLayer = AVPlayerLayer(player: player)
playerLayer.frame = self.playerView.bounds
playerLayer.cornerRadius = 5.0
playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill
superLayer.addSublayer(playerLayer)
self.view.bringSubview(toFront: playVideoButton)
问题是playVideoButton 没有显示在playerLayer 的顶部(按钮已添加到情节提要中)。我尝试隐藏playerLayer,但该按钮仍然没有显示在下方,因此该按钮似乎甚至不在视图层次结构中。
【问题讨论】:
标签: button avplayer avplayerlayer