我想要打印一些PDF NSData,当我提交UIPrintInteractionController
时,PDF正确显示,但UITableViewCell
UIPrintInteractionController
上的文字和其他数据不可见。< / p>
代码:
UIPrintInteractionController *printController = [UIPrintInteractionController sharedPrintController];
printController.delegate = self;
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.jobName = [self.pdfURL lastPathComponent];
printInfo.duplex = UIPrintInfoDuplexLongEdge;
printController.printInfo = printInfo;
printController.showsPageRange = YES;
printController.printingItem = self.pdfData;
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
if (!completed && error) {
NSLog(@"FAILED! due to error in domain %@ with error code %lu", error.domain, (long)error.code);
}
};
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[printController presentFromBarButtonItem:sender animated:true completionHandler:completionHandler];
} else {
[printController presentAnimated:YES completionHandler:completionHandler];
}
什么可能导致这样的问题以及如何解决?
更新
忽略此问题后,我发现我的应用中UITableViewCell
的任何子类都将textLabel.textColor
默认设置为白色。我无法以编程方式或在IB中进行更改。
答案 0 :(得分:0)
问题是我的UITableViewCell
类别覆盖了layoutSubviews
方法,如:
- (void)layoutSubviews {
[super layoutSubviews];
// some configurations
}
删除此方法后,一切正常。