iOS 9 : UIPrintInteractionController presentation issue
<p><p>我在这个极其奇怪的问题上苦苦挣扎了几天。这是用于初始化和呈现打印对话框的标准代码,在 iOS 9 之前它可以完美运行:</p>
<pre><code>- (void)setupPrinting:(UIPrintInteractionController *)aPrintController
{
NSString *text = ;
UIMarkupTextPrintFormatter *formatter = [[ initWithMarkupText:text] autorelease];
aPrintController.printFormatter = formatter;
}
- (IBAction)printContent:(id)aSender {
if () {
UIPrintInteractionController *printController = ;
printController.delegate = self;
;
//tried different ways to present print controller
// ;
// [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 = .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);
}];
}
}
</code></pre>
<p>在 iOS 9 上,打印对话框显示错误并且无法关闭,在模态视图之外点击无效 - 应用程序变得无响应。</p>
<p> <a href="/image/lTqgV.png" rel="noreferrer noopener nofollow"><img src="/image/lTqgV.png" alt="enter image description here"/></a> </p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>正在发生的事情是取消和打印按钮被模式窗口剪裁,让您停留在该 View 中。如果有人遇到类似问题,请检查您是否在 <code>UINavigationBar</code> 类上设置了固定宽度。更新后,按钮应该会回到模式中。</p></p>
<p style="font-size: 20px;">关于iOS 9 : UIPrintInteractionController presentation issue,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/33690154/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/33690154/
</a>
</p>
页:
[1]