我用RPCreenRecorder录制了一段视频。一切都很好。
现在我想自定义预览控制器的UI,如何更改取消和保存按钮的颜色?嗯,一般我知道如何更改UIBarButtonItem的颜色:
let cancelBtn = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(self.dismissView))
cancelBtn.setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.red], for: .normal)
但是我在预览中找不到按钮的引用(RPPreviewViewController)。
func stopRecorder() {
recorder.stopRecording { [unowned self] (preview, error) in
guard let previewVC = preview else {
return
}
previewVC.previewControllerDelegate = self
previewVC.modalPresentationStyle = .fullScreen
self.present(previewVC, animated: true, completion: nil)
}
}
``
2条答案
按热度按时间0vvn1miw1#
在呈现/推送视图控制器时尝试以下代码
请注意:不要忘记在关闭/弹出视图控制器时重置所有这些值,因为所有这些值都适用于整个应用程序的所有导航控制器。
laximzn52#
如果你在SwiftUI中使用RPPreviewViewController,我可以使用accentColor更改预览控制器导航栏中按钮的颜色。