Configuring bottom bar in QLPreviewController
Asked Answered
S

3

7

I have integrated QLPreviewController and UIDocumentInteractionController in my app, and it is working fine.

The only problem is- I want to configure the bottom toolbar, I want to remove the default toolbar items, which appear as shown in image below:

Bottom tool-bar with items to be removed

Is there any way to do so, please suggest.

Shoelace answered 2/10, 2013 at 18:49 Comment(2)
set the toolbar to nil and call setneedsdisplayCannonade
Did you get any solution for this? Not working in iOS 7.Nitrogenous
P
2

Short Answer: NO, Not in IOS6+

Description:

One thing to note about QLPreviewController is that it's not meant to be customized. There were other libraries allowing you to change the functionality such as:

https://github.com/rob-brown/RBFilePreviewer

Which are not working in iOS 6+ since apple made a big change in QLPreviewController and it's technically running in a separate process. Although it might be possible (not sure) using private apis but your app will be rejected then.

You can find more info about this change here: http://oleb.net/blog/2012/10/remote-view-controllers-in-ios-6/

Hope this helps

Plowman answered 16/10, 2013 at 23:19 Comment(2)
Just thinking how whatsapp guys might have configured it? I mean they show a small 'delete icon' in bottom right and 'All Media Files' on top, which in default preview controller case appears at bottom right.Shoelace
@Miraaj they might have their own viewer. not sure. also look at iOS8 stuff there might be something new in this regardPlowman
W
3
  1. Subclass UIToolbar
  2. Create UINavigationController using init(navigationBarClass:toolbarClass:) and supply UIToolbar subsclass created in step 1 for toolbarClass
  3. Create QLPreviewController instance and push onto UINavigationController stack
  4. Inside of UIToolbar subsclass override setItems(_:animated:). To remove all buttons call super with empty array super.setItems([], animated: false) or potentially you can add only buttons you want to keep.
  5. Present UINavigationController created in step 2

Here is the example PreviewControllerHideBottomButtons

Wongawonga answered 2/9, 2016 at 21:33 Comment(0)
P
2

Short Answer: NO, Not in IOS6+

Description:

One thing to note about QLPreviewController is that it's not meant to be customized. There were other libraries allowing you to change the functionality such as:

https://github.com/rob-brown/RBFilePreviewer

Which are not working in iOS 6+ since apple made a big change in QLPreviewController and it's technically running in a separate process. Although it might be possible (not sure) using private apis but your app will be rejected then.

You can find more info about this change here: http://oleb.net/blog/2012/10/remote-view-controllers-in-ios-6/

Hope this helps

Plowman answered 16/10, 2013 at 23:19 Comment(2)
Just thinking how whatsapp guys might have configured it? I mean they show a small 'delete icon' in bottom right and 'All Media Files' on top, which in default preview controller case appears at bottom right.Shoelace
@Miraaj they might have their own viewer. not sure. also look at iOS8 stuff there might be something new in this regardPlowman
I
0
  • Subclass QLPreviewController.
  • Search for the Toolbar in the view hierarchy.
  • Have a UIToolbar property in your class that has the same frame as the original toolbar.
  • Place your own toolbar above the default one with whatever buttons you want.
  • If you want it to be hidden as the default behavior of the QLPreviewController you can key value observe the hidden property of the default toolbar and present / hide your own accordingly.
Ivanna answered 9/12, 2013 at 16:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.