I've been trying to get a UIPrinterPicker to show up but for some reason it just never does. The completion handler gets called immediately. The UIPrintInteractionController shows up just fine but this one refuses to show for some reason. This is the code I am using currently
let picker = UIPrinterPickerController(initiallySelectedPrinter: nil)
picker.present(animated: true) { (controller, complete, error) in
print("done")
}
Implement UIPrinterPickerControllerDelegate so it works for iOS 13 https://developer.apple.com/documentation/uikit/uiprinterpickercontroller/1620514-present
class ViewController: UIViewController {
@IBAction func btnTapped(_ sender: Any) {
let picker = UIPrinterPickerController(initiallySelectedPrinter: nil)
picker.delegate = self
picker.present(animated: true) { (controller, complete, error) in
print("done")
}
}
}
// MARK:- UIPrinterPickerControllerDelegate
extension ViewController: UIPrinterPickerControllerDelegate {
func printerPickerControllerParentViewController(_ printerPickerController: UIPrinterPickerController) -> UIViewController? {
return self
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.