Fix where navigationview is determined
This commit is contained in:
parent
e677be7128
commit
365cacc2ae
|
@ -211,7 +211,7 @@ class PlayerViewController: UIViewController, GCKDiscoveryManagerListener, GCKRe
|
|||
|
||||
@IBAction func settingsButtonTapped(_ sender: UIButton) {
|
||||
optionsVC = VideoPlayerSettingsView()
|
||||
optionsVC?.delegate = self
|
||||
optionsVC?.playerDelegate = self
|
||||
|
||||
optionsVC?.modalPresentationStyle = .popover
|
||||
optionsVC?.popoverPresentationController?.sourceView = playerSettingsButton
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
class VideoPlayerSettingsView: UIViewController {
|
||||
class VideoPlayerSettingsView: UINavigationController {
|
||||
private var contentView: UIHostingController<VideoPlayerSettings>!
|
||||
weak var delegate: PlayerViewController?
|
||||
weak var playerDelegate: PlayerViewController?
|
||||
|
||||
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
|
||||
.landscape
|
||||
|
@ -18,18 +18,13 @@ class VideoPlayerSettingsView: UIViewController {
|
|||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
contentView = UIHostingController(rootView: VideoPlayerSettings(delegate: self.delegate ?? PlayerViewController()))
|
||||
self.view.addSubview(contentView.view)
|
||||
contentView.view.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.view.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
|
||||
contentView.view.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
|
||||
contentView.view.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
|
||||
contentView.view.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
|
||||
|
||||
self.viewControllers = [UIHostingController(rootView: VideoPlayerSettings(delegate: self.playerDelegate ?? PlayerViewController()))]
|
||||
}
|
||||
|
||||
override func viewWillDisappear(_ animated: Bool) {
|
||||
super.viewWillDisappear(animated)
|
||||
self.delegate?.settingsPopoverDismissed()
|
||||
self.playerDelegate?.settingsPopoverDismissed()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +39,6 @@ struct VideoPlayerSettings: View {
|
|||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
Form {
|
||||
Picker(NSLocalizedString("Closed Captions", comment: ""), selection: $captionTrack) {
|
||||
ForEach(delegate.subtitleTrackArray, id: \.id) { caption in
|
||||
|
@ -85,7 +79,6 @@ struct VideoPlayerSettings: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.offset(y: UIDevice.current.userInterfaceIdiom == .pad ? 14 : 0)
|
||||
.onAppear(perform: {
|
||||
captionTrack = self.delegate.selectedCaptionTrack
|
||||
|
|
Loading…
Reference in New Issue