-1
如何將TextView中的文本轉換爲NSString?如何將TextView內部的文本轉換爲NSString?
NSString *path = tabels.text;
NSData *dataFromPath = [NSData dataWithContentsOfFile:path];
UIPrintInteractionController *printController = [UIPrintInteractionController sharedPrintController];
if(printController && [UIPrintInteractionController canPrintData:dataFromPath]) {
printController.delegate = self;
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.jobName = [path lastPathComponent];
printInfo.duplex = UIPrintInfoDuplexLongEdge;
printController.printInfo = printInfo;
printController.showsPageRange = YES;
printController.printingItem = dataFromPath;
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
if (!completed && error) {
NSLog(@"FAILED! due to error in domain %@ with error code %u", error.domain, error.code);
}
};
[printController presentAnimated:YES completionHandler:completionHandler];
}
沒有爲AirPrint的工作;( – Rafael 2011-04-17 03:08:54
@Rafael - 如果你不介意的話,請給你的問題的更詳細說明我沒有辦法知道你的問題有什麼關係。請使用AirPrint,如果您發佈了您的代碼,並說明問題所在,我會很樂意嘗試和協助您。:-) – Moshe 2011-04-17 03:10:46
我放了代碼。 – Rafael 2011-04-17 03:26:44