parent
5bd7c0ad2b
commit
84cf755332
|
@ -14,6 +14,30 @@ protocol ComposeDrawingViewControllerDelegate: AnyObject {
|
|||
func composeDrawingViewController(_ drawingController: ComposeDrawingViewController, saveDrawing drawing: PKDrawing)
|
||||
}
|
||||
|
||||
class ComposeDrawingNavigationController: UINavigationController {
|
||||
override var preferredStatusBarStyle: UIStatusBarStyle {
|
||||
.darkContent
|
||||
}
|
||||
|
||||
init(editing initialDrawing: PKDrawing, delegate: ComposeDrawingViewControllerDelegate) {
|
||||
let vc = ComposeDrawingViewController(editing: initialDrawing)
|
||||
vc.delegate = delegate
|
||||
super.init(rootViewController: vc)
|
||||
|
||||
modalPresentationStyle = .fullScreen
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
overrideUserInterfaceStyle = .light
|
||||
}
|
||||
}
|
||||
|
||||
class ComposeDrawingViewController: UIViewController {
|
||||
|
||||
weak var delegate: ComposeDrawingViewControllerDelegate?
|
||||
|
@ -63,7 +87,8 @@ class ComposeDrawingViewController: UIViewController {
|
|||
canvasView.drawingPolicy = .anyInput
|
||||
canvasView.minimumZoomScale = 0.5
|
||||
canvasView.maximumZoomScale = 2
|
||||
canvasView.backgroundColor = .systemBackground
|
||||
canvasView.backgroundColor = .white
|
||||
canvasView.overrideUserInterfaceStyle = .light
|
||||
canvasView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(canvasView)
|
||||
NSLayoutConstraint.activate([
|
||||
|
@ -74,6 +99,7 @@ class ComposeDrawingViewController: UIViewController {
|
|||
])
|
||||
|
||||
toolPicker = PKToolPicker()
|
||||
toolPicker.overrideUserInterfaceStyle = .light
|
||||
toolPicker.setVisible(true, forFirstResponder: canvasView)
|
||||
toolPicker.addObserver(canvasView)
|
||||
toolPicker.addObserver(self)
|
||||
|
|
|
@ -360,11 +360,7 @@ extension ComposeHostingController: ComposeUIStateDelegate {
|
|||
drawing = PKDrawing()
|
||||
}
|
||||
|
||||
let drawingVC = ComposeDrawingViewController(editing: drawing)
|
||||
drawingVC.delegate = self
|
||||
let nav = UINavigationController(rootViewController: drawingVC)
|
||||
nav.modalPresentationStyle = .fullScreen
|
||||
present(nav, animated: true)
|
||||
present(ComposeDrawingNavigationController(editing: drawing, delegate: self), animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue