All buttons in ViewController triggering AirPrint Swift

38 views Asked by At

I have one button (attached to an IBAction) in a ViewController that prints a UIView. I have another button that is attached to another IBAction that performs a segue to another ViewController. This is my code for the button that prints:

@IBAction func print(_ sender: Any) {
        
        let info = UIPrintInfo(dictionary:nil)
           info.outputType = UIPrintInfo.OutputType.general
           info.jobName = "Print Signature!"

           let vc = UIPrintInteractionController.shared
           vc.printInfo = info

           vc.printingItem = UIImage.image(fromView: scratchpad) 

           vc.present(from: self.scratchpad.frame, in: scratchpad, animated: true, completionHandler: nil)
        
    }

However all the buttons in the ViewController are triggering the AirPrint dialogue whereas only the Print button should. Is there a problem with the code for the print button?

0

There are 0 answers