Привет, У меня есть приложение iOS, которое имеет возможность распечатывать UITableView. Однако печатается только одна часть отображаемого таблицы. Есть ли способ распечатать весь tableview, даже если он еще не нарисован?Печать UITableView с содержимым с экрана?
Вот код, я использую для печати:
UIGraphicsBeginImageContext(self.mainTableView.contentSize);
[self.mainTableView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIPrintInteractionController *printer = [UIPrintInteractionController sharedPrintController];
printer.printingItem = viewImage;
UIPrintInfo *info = [UIPrintInfo printInfo];
printer.printInfo = info;
UIPrintInteractionCompletionHandler completionHandler =
^(UIPrintInteractionController *pic, BOOL completed, NSError *error) {
if (!completed && error)
NSLog(@"FAILED! due to error in domain %@ with error code %u: %@",
error.domain, error.code, [error localizedDescription]);
};
UIButton * printButton = (UIButton *)sender;
if(UIUserInterfaceIdiomPad == [[UIDevice currentDevice] userInterfaceIdiom]){
[printer presentFromRect:printButton.frame inView:self.view animated:YES completionHandler:completionHandler];
} else {
[printer presentAnimated:YES completionHandler:completionHandler];
}