IOS 4.2 AirPrint調用__IOS
來源:互聯網
上載者:User
#pragma mark - #pragma mark Application lifecycle #define pdfUrl - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. #if __IPHONE_OS_VERSION_MAX_ALLOWED > 40100 UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController]; UIPrintInfo *printInfo = [UIPrintInfo printInfo]; printInfo.outputType = UIPrintInfoOutputGeneral; printInfo.jobName = @"Air Print test"; printInfo.duplex = UIPrintInfoDuplexLongEdge; controller.printInfo = printInfo; controller.showsPageRange = YES; controller.printingItem = @"asfasdf"; void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *pic, BOOL completed, NSError *error) { //self.content = nil; if (!completed && error) NSLog(@"FAILED! due to error in domain %@ with error code %u", error.domain, error.code); }; // // if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { // [controller presentFromRect:printBtn.frame // inView:self.view // animated:YES // completionHandler:completionHandler]; // } else { [controller presentAnimated:YES completionHandler:completionHandler]; // } #endif [self.window makeKeyAndVisible]; return YES; }