Swift 使用IOS打印文档

Swift 使用IOS打印文档_第1张图片
AirPrint
@IBOutlet weak var textView: UITextView!
@IBAction func print(sender: AnyObject) {
    
    let printInteraction = UIPrintInteractionController.sharedPrintController()
    
    let textFormatter = UISimpleTextPrintFormatter(text: self.textView.text)
    printInteraction.printFormatter = textFormatter
    printInteraction.presentAnimated(true) { (UIPrintInteractionController, Bool, NSError) -> Void in
        
    }
}

你可能感兴趣的:(Swift 使用IOS打印文档)