2016-03-29 3 views
1

Я хочу распечатать некоторые NSData в формате PDF, а когда я представляю UIPrintInteractionController PDF-файл представлен правильно, но текстовые и другие данные на UITableViewCell из UIPrintInteractionController не отображаются.Текст в UIPrintInteractionController не отображается

Изображение: 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]; 
} 

Что может вызвать такую ​​проблему и как ее решить?

UPDATE:

После игнорирования этого вопроса, я обнаружил, что любой подкласс UITableViewCell в моем приложении имеет textLabel.textColor по умолчанию устанавливается в белый цвет. И я не могу изменить его программно или в IB.

ответ

0

Проблема заключалась в том, что у меня есть категория UITableViewCell который переопределяет метод layoutSubviews как:

- (void)layoutSubviews { 
    [super layoutSubviews]; 

    // some configurations 
} 

После удаления этого метода, все работает отлично.

 Смежные вопросы

  • Нет связанных вопросов^_^