Note that there are some explanatory texts on larger screens.

plurals
  1. POQLPreviewController remove or add UIBarButtonItems
    text
    copied!<p>I have seen this kind of question a lot on the internet but it seems no one really knows the answer?</p> <p>I am using QLPreviewController for displaying PDF documents. I first used a UIWebView but I was recommended to use QLPreviewController instead for performance reasons with bigger documents.</p> <p>what I want is 4 custom UIBarButtonItem's in the top right (so where the print button is).</p> <p>I managed to get a custom toolbar at the bottom, but that's not really what I want.</p> <p>Considering that it is not possible to add custom button at the place of the print button, I still want to remove the printbutton and use the custom toolbar instead.</p> <p><strong>EDIT (Solution):</strong> <em>I found the solution a while ago but didn't update this post so here is how I solved the problem:</em></p> <p>I add al the buttons manually:</p> <pre><code>// Create a toolbar to have the buttons at the right side of the navigationBar UIToolbar* toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 180, 44.01)]; [toolbar setTranslucent:YES]; // Create the array to hold the buttons, which then gets added to the toolbar NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:4]; // Create button 1 button1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self action:@selector(button1Pressed)]; [buttons addObject:button1]; // Create button 2 button2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:self action:@selector(button2Pressed)]; [buttons addObject:button2]; // Create button 3 button3 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(button3Pressed)]; [buttons addObject:button3]; // Create a action button openButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(openWith)]; [buttons addObject:openButton]; // insert the buttons in the toolbar [toolbar setItems:buttons animated:NO]; // and put the toolbar in the navigation bar [[self navigationItem] setRightBarButtonItem:[[UIBarButtonItem alloc] initWithCustomView:toolbar]]; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload