iosuitableviewuiprintinteractioncntrler

Text in UIPrintInteractionController is not visible


I want to print some PDF NSData, and when I present UIPrintInteractionController PDF presents correctly, but text and other data on UITableViewCell's of UIPrintInteractionController not visible.

Image: enter image description here

Code:

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?

UPDATE:

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


Solution

  • 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.