相关疑难解决方法(0)

QLPreviewController删除或添加UIBarButtonItems

我在互联网上看到了很多这样的问题,但似乎没有人真正知道答案?

我正在使用QLPreviewController来显示PDF文档.我首先使用了UIWebView,但我建议使用QLPreviewController来代替性能较大的文档.

我想要的是右上角的4个自定义UIBarButtonItem(所以打印按钮在哪里).

我设法在底部找到一个自定义工具栏,但这不是我想要的.

考虑到无法在打印按钮的位置添加自定义按钮,我仍然想要删除打印按钮并使用自定义工具栏.

编辑(解决方案): 我刚刚找到解决方案,但没有更新这篇文章,所以这里是我解决问题的方法:

我手动添加按钮:

// 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 …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uibarbuttonitem ipad qlpreviewcontroller

16
推荐指数
2
解决办法
2万
查看次数

UIDocumentInteractionController在没有选项的特定应用程序中打开文件

我正在使用UIDocumentInteractionController在另一个应用程序DropBox中打开一个文件.

我想要做的是在另一个特定的应用程序中打开该文件,但我只管理到目前为止显示支持的应用程序并允许用户选择.

UIDocumentInteractionController *udi = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath: jpgPath]];
[udi retain];
CGRect r = CGRectMake(0, 0, 300, 300);
[udi presentOpenInMenuFromRect:r inView:self.view animated:YES];
Run Code Online (Sandbox Code Playgroud)

这提供了支持的应用程序列表,但我想使用dropbox直接打开文件,而不使用选项框.有任何想法吗?

iphone objective-c handler ios uidocumentinteraction

6
推荐指数
1
解决办法
4744
查看次数