Vote count:
0
Here is the code I use for Swift airprinting with beta 6 and it worked fine:
@IBAction func button3Tapped() {
var pic:UIPrintInteractionController = .sharedPrintController()
var viewpf:UIViewPrintFormatter = myTextView.viewPrintFormatter()
pic.delegate = self
pic.showsPageRange = true
pic.printFormatter = viewpf
if UIDevice.currentDevice().userInterfaceIdiom == .Pad {
pic.presentFromRect(self.myButton3.frame, inView:self.view, animated:true, completionHandler: nil)
} else {
pic.presentAnimated(true, completionHandler: nil)
}
}
Of course, beta 7 broke it with a "Value of optional type 'UIPrintInteractionController' not unwrapped; did you mean to use ! or ??" on the first var line. Unfortunately the XCode suggested fix doesn't fix it, and I'm not smart enough to figure it out myself!
Any help would be greatly appreciated!
Thank you.
Jim
asked 57 secs ago
Printing in iOS from Swift in XCode 6 beta 7
Aucun commentaire:
Enregistrer un commentaire