2
我在這個極其奇怪的問題上掙扎了好幾天。下面是初始化和呈現打印對話框,它的iOS 9之前,工作完美的標準代碼:iOS 9:UIPrintInteractionController演示文稿問題
- (void)setupPrinting:(UIPrintInteractionController *)aPrintController
{
NSString *text = [self formattedHTMLforPrinting];
UIMarkupTextPrintFormatter *formatter = [[[UIMarkupTextPrintFormatter alloc] initWithMarkupText:text] autorelease];
aPrintController.printFormatter = formatter;
}
- (IBAction)printContent:(id)aSender {
if ([UIPrintInteractionController isPrintingAvailable]) {
UIPrintInteractionController *printController = [UIPrintInteractionController sharedPrintController];
printController.delegate = self;
[self setupPrinting:printController];
//tried different ways to present print controller
// [printController presentAnimated:NO completionHandler:nil];
// [printController presentFromRect:self.view.bounds inView:self.view animated:YES
//these two lines are just to make sure printButton is not nil
self.printButton.layer.borderColor = [UIColor redColor].CGColor;
self.printButton.layer.borderWidth = 1.0;
[printController presentFromRect:self.printButton.bounds inView:self.printButton animated:YES
completionHandler:^(UIPrintInteractionController *aPrintController, BOOL aCompleted, NSError *anError)
{
NSLog(@"printing is done with error: %@", anError);
}];
}
}
在iOS 9打印對話框顯示錯誤,不能被解僱攻外模式的看法沒有任何效果 - 應用程序變得反應遲鈍。
我面臨與最新版本的iOS相同的問題。你能幫我解決嗎?你是如何修復它的? – spaleja