在 iPad 打印预览中不显示 UILabel。当我放大打印预览时,它会正确显示。当我将 UILabelopaque
属性更改为true
它时,它将 UILabel 的背景更改为黑色并显示在打印预览中。这是我用来显示打印预览的代码。
let printController = UIPrintInteractionController.shared
let printInfo = UIPrintInfo(dictionary:nil)
printInfo.outputType = UIPrintInfoOutputType.general
printInfo.jobName = "Print"
printInfo.duplex = UIPrintInfoDuplex.none
printInfo.orientation = UIPrintInfoOrientation.portrait
printController.printPageRenderer = nil
printController.printingItems = nil
printController.printingItem = printUrl
printController.printInfo = printInfo
printController.showsNumberOfCopies = true
printController.showsPaperSelectionForLoadedPapers = true
printController.present(animated: true, completionHandler: nil)
当我更改它时UIPrintInfoOutputType.general
,UIPrintInfoOutputType.grayscale
它会显示 UILabel,但我需要彩色打印。灰度仅适用于黑白打印。