here is my code, I am unsure on how to AirPrint the UILabel. If anyone could help me out that would be highly appreciated.
@IBOutlet weak var cityLbl: UILabel!
@IBAction func printButton(_ sender: Any) {
self.printText()
}
func printText() {
let printController = UIPrintInteractionController.shared
let printI = UIPrintInfo(dictionary: nil)
printI.jobName = "printing this image"
printI.outputType = .general
printController.printInfo = printI
printController.printingItem = cityLbl
printController.present(animated: true) { (_, isPrinted, error) in
if error == nil {
if isPrinted {
print("image is printed")
} else {
print("image is not printed")
}
}
}
}
答案 0 :(得分:0)
you check is this item is printable or not
func printText() {
if UIPrintInteractionController.canPrint(cityLbl) {
//your code
}
}