In my application I need to open the file like .doc or .txt. I have implemented UIDocumentInteractionController to view the files, when I call presentPreviewAnimated new controller is presented with document inside on the current controller. I have some queries related with same.
- can we use the only document view from UIDocumentInteractionController in side our controller rather using controller from UIDocumentInteractionController?
- can we customize the the navigation bar of UIDocumentInteractionController. I need to some more additional button on the preview.
QLPreviewController not able to开发者_Go百科 use , as it supports only above 4.0 and I need a support from 3.2
Thanks.
Short answer - No. Not yet it seems.
Apple has not made public API's that will allow you to modify those views. While it may be possible to dive into the View tree structure and modify the underlying elements (or pull the view from the underlying elements and put them into your own), this would be an ugly ugly hack, as Apple could change their private implementation at any time breaking your app for later versions.
You can add additional buttons to the navigation bar using the navigationItem property. After calling presentPreviewAnimated, you can get at the navigationItem from your navigationController:
UINavigationItem *ni = [[navigationController.viewControllers lastObject] navigationItem] ;
You could set the leftBarButtonItem or leftBarButtonItems using something like:
ni.leftBarButtonItem = [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:controller action:@selector(someSelector:)] ;
You can affect the right bar button in a similar fashion, but you need to wait until after the loading of the content has fully completed.
You can get even more control by using a category to replace QLPreviewController's navigationItem implementation with one of your own.
精彩评论