我有一个uipageviewcontroller并在uipageviewcontroller中设置了一个名为contentviewcontroller的子视图控制器.
thePageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl navigationOrientation: UIPageViewControllerNavigationOrientationHorizontal options:nil];
thePageViewController.delegate = self;
thePageViewController.dataSource = self;
thePageViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
contentViewController = [[HBDocumentChildViewController alloc] initWithPDF:PDFDocument];
contentViewController.page = [modelArray objectAtIndex:0];
NSArray *viewControllers = [NSArray arrayWithObject:contentViewController];
[thePageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
[self addChildViewController:thePageViewController];
[self.view addSubview:thePageViewController.view];
thePageViewController.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
[thePageViewController didMoveToParentViewController:self];
self.view.gestureRecognizers = thePageViewController.gestureRecognizers;
self.view.backgroundColor = [UIColor underPageBackgroundColor];
Run Code Online (Sandbox Code Playgroud)
我已经完成了借助滚动视图类(pdfScrollView)将pdf文件加载到uipageviewcontroller中的页面.followig是uipageviewcontroller的内容类并初始化uiscrollview类.
#import "HBDocumentChildViewController.h"
@interface HBDocumentChildViewController ()<UIWebViewDelegate>
{
int currentPage;
NSString*localPath;
}
@end
@implementation HBDocumentChildViewController
#pragma mark - View lifecycle
- (void)viewDidLoad
{ …Run Code Online (Sandbox Code Playgroud) uiscrollview uiviewcontroller uiscrollviewdelegate ios uipageviewcontroller
我可以找到一些代码来跳过打印UI并通过Air Printer直接打印.但代码不完整.代码如下,
UIPrinterPickerController *printPicker = [UIPrinterPickerController printerPickerControllerWithInitiallySelectedPrinter:self.savedPrinter];
[printPicker presentAnimated:YES completionHandler:
^(UIPrinterPickerController *printerPicker, BOOL userDidSelect, NSError *error) {
if (userDidSelect) {
self.savedPrinter = printerPicker.selectedPrinter;
}
}];
Run Code Online (Sandbox Code Playgroud)
在这段代码中,提到了self.savedPrinter.但是我如何在这里获得保存的打印机.请给我一个完整的答案或样本解决方案.
printing objective-c airprint uiprintinteractioncntrler ios8