2

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.

1 Answer 1

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.