Change ComposeDrawingViewController to use drawingPolicy on iOS 14
This commit is contained in:
parent
154fc7cd02
commit
50f1a9a7de
|
@ -58,7 +58,11 @@ class ComposeDrawingViewController: UIViewController {
|
||||||
canvasView.drawing = initialDrawing
|
canvasView.drawing = initialDrawing
|
||||||
}
|
}
|
||||||
canvasView.delegate = self
|
canvasView.delegate = self
|
||||||
|
if #available(iOS 14.0, *) {
|
||||||
|
canvasView.drawingPolicy = .anyInput
|
||||||
|
} else {
|
||||||
canvasView.allowsFingerDrawing = true
|
canvasView.allowsFingerDrawing = true
|
||||||
|
}
|
||||||
canvasView.minimumZoomScale = 0.5
|
canvasView.minimumZoomScale = 0.5
|
||||||
canvasView.maximumZoomScale = 2
|
canvasView.maximumZoomScale = 2
|
||||||
canvasView.backgroundColor = .systemBackground
|
canvasView.backgroundColor = .systemBackground
|
||||||
|
@ -75,6 +79,7 @@ class ComposeDrawingViewController: UIViewController {
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
super.viewWillAppear(animated)
|
super.viewWillAppear(animated)
|
||||||
|
|
||||||
|
// todo: should the PKToolPicker be owned by this VC or something else?
|
||||||
if let window = parent?.view.window, let toolPicker = PKToolPicker.shared(for: window) {
|
if let window = parent?.view.window, let toolPicker = PKToolPicker.shared(for: window) {
|
||||||
toolPicker.setVisible(true, forFirstResponder: canvasView)
|
toolPicker.setVisible(true, forFirstResponder: canvasView)
|
||||||
toolPicker.addObserver(canvasView)
|
toolPicker.addObserver(canvasView)
|
||||||
|
|
Loading…
Reference in New Issue