Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to customize appearance of UIPrintInteractionController

Tags:

ios

The apple blue does not match my app colors so the print dialog is very jarring.

In my iPhone app I am able to get the proper nav bar and background colors with the following UIPrintInteractionControllerDelegate code.

- (UIViewController *)printInteractionControllerParentViewController:   (UIPrintInteractionController *)printInteractionController
{
   return self.navigationController;
}
- (void)printInteractionControllerDidPresentPrinterOptions:(UIPrintInteractionController *)printInteractionController
{
   self.navigationController.topViewController.view.backgroundColor = [UIColor whiteColor];   
}

The problem is that I use a custom UIPrintPageRenderer class to render my page. This seems to trigger a screen that pops up after the print job has been sent. It has a nav bar with a Done button and a message below saying "sending to printer". I assume this is so you can see multiple pages being sent (I only have one). This pops up after the options dialog has gone away and you have been returned to your original screen where you initiated everything.

The "sending to printer" screen is blue and ugly to the max. Is there anyway to eliminate it or customize its appearance?"

like image 959
Jim T Avatar asked May 15 '12 21:05

Jim T


1 Answers

I don't know your full code, but you could try the appearance protocol. That essentially allows you to set the universal colour (or other property) of particular UI elements like buttons and bars. So you could, to set the background colour of the print controller's nav bar, use the following code:

[[UINavigationBar appearance] setTintColor:[UIColor redColor]];

That would make all navigation bars in your app, including the print navigation controller's, to be red. You can then later change ones that you do not want to be red by setting their bar's appearance (i.e self.navigationController.navigationBar.tintColor).

By the way, this works for iOS 7, iOS 6 does not have the tint colour property, I think it instead just uses background colour.

like image 179
Jack Solomon Avatar answered Oct 07 '22 23:10

Jack Solomon