Chika Chika - 1 year ago 100
iOS Question

Text in UIPrintInteractionController is not visible

I want to print some PDF NSData, and when I present

PDF presents correctly, but text and other data on
's of
not visible.

enter image description here


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];

What can cause such problem and how to solve it?


After ignoring this issue, I found that any subclass of
in my app has
set by default to white color. And I can't change it programmatically or in IB.

Answer Source

The problem was that I have category of UITableViewCell which overrides layoutSubviews method like:

- (void)layoutSubviews {
    [super layoutSubviews];

    // some configurations

After removing this method, everything works fine.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download