很直接...
这些天我认为自己是一名经验丰富的 iOS 开发人员,但这似乎是 iOS 中一个明显的错误,除非我错过了什么。
请看下面的代码。
文件路径指向两个一页的 PDF。
显示的是一个没有要打印的内容的打印交互控制器。
如果我一次只做 1 个文件,如下所示:
pc.printingItem = [NSURL fileURLWithPath:filePath1];
Run Code Online (Sandbox Code Playgroud)
它就像一个冠军。
我在这里错过了什么?!
UIPrintInteractionController *pc = [UIPrintInteractionController sharedPrintController];
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputPhoto;
printInfo.orientation = UIPrintInfoOrientationLandscape;
pc.printInfo = printInfo;
pc.printingItems = @[[NSURL fileURLWithPath:filePath1],
[NSURL fileURLWithPath:filePath2]];
[pc presentAnimated:YES completionHandler:completionHandler];
Run Code Online (Sandbox Code Playgroud)
我一直在努力使用UINavigationalController在视图之间切换.我已多次使用此系统而没有问题但在我的新应用程序中它无法正常工作.
这是问题:当我推动一个新的视图控制器时,我使用以下代码:
NewViewController *newVC = [[NewViewController alloc] initWithNib:@"NewView" bundle:nil];
[self.navigationController pushViewController:newVC animated:YES];
[newVC release];
Run Code Online (Sandbox Code Playgroud)
我用来返回newVC内部的前一个视图的代码是:
[self.navigationController popViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)
我正在读这可能会释放self.navigationController本身,所以我实现了这段代码:
UINavigationController *nc = [self navigationController];
[nc popViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)
什么结果是平滑过渡到newVC而没有白色闪光,但是当返回到原始页面时,屏幕闪烁白色,就像它在转换回原始页面之前释放newVC一样.然而!在调试时,我在原始页面的viewWillAppear和newVC的dealloc以及带有白色闪存的viewWillAppear +转换上放置了断点,在调用newVC的dealloc之前完成所有断点.
如果有人可以帮助发光,我会非常感激.
谢谢!〜阿拉什