添加“在Excel中编辑”或“编辑照片”延期 [英] Add "Edit in Excel" or "Edit photo" extension

查看:180
本文介绍了添加“在Excel中编辑”或“编辑照片”延期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我检查了最新的Dropbox和Excel for iOS。在Dropbox中,我们得到一个编辑按钮。点击它打开Excel的扩展名,您可以在其中编辑文件。



保存后,更改也会反映在Dropbox文件中。



我想添加这样一个按钮。此外,我想在图片中添加如下按钮,以便在可用的照片编辑应用程序中打开它们。



如何检查是否可以打开文件(图像,xls,doc或其他)来编辑?



到目前为止的代码

  UIDocumentPickerViewController * documentPicker = [[UIDocumentPickerViewController alloc] initWithURL:url inMode: UIDocumentPickerModeExportToService]; 
documentPicker.delegate = self;
documentPicker.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:documentPicker animated:YES completion:nil];

还尝试将模式更改为 UIDocumentPickerModeMoveToService





根据apple docs
移动本地文档。用户选择外部目的地。文档选择器移动文档;但是,您仍然可以将文档作为外部文档访问,让用户将文档编辑到位。



但是我尝试了所有四种模式。没有显示excel选项。

  UIDocumentPickerModeImport,
UIDocumentPickerModeOpen,
UIDocumentPickerModeExportToService,
UIDocumentPickerModeMoveToService


解决方案

与其他iOS应用程序本地通信的唯一方法正在使用所谓的URLSchemes。



这是使用URLScheme与MSOffice应用程序的文档。


I checked the latest Dropbox and Excel for iOS. In Dropbox we get an edit button. On click it opens Excel's extension where you can edit the file.

After save, changes are reflected in the Dropbox file too.

I want to add such a button. Also I'd like to add such a button to images to open them in available "photo editing" apps.

How to check if file (image, xls, doc or any other) can be opened to edit?

Code so far:

UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithURL:url inMode:UIDocumentPickerModeExportToService];
documentPicker.delegate = self;
documentPicker.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:documentPicker animated:YES completion:nil];

Also tried changing mode to UIDocumentPickerModeMoveToService...

As per apple docs Move a local document. The user selects an external destination. The document picker moves the document; however, you can still access the document as an external document, letting the user edit the document in place.

But I tried all four modes. Did not show excel option.

   UIDocumentPickerModeImport,
   UIDocumentPickerModeOpen,
   UIDocumentPickerModeExportToService,
   UIDocumentPickerModeMoveToService 

解决方案

The only way to communicate with other iOS apps "locally" is using what is called URLSchemes.

This is the documentation to use URLScheme with the MSOffice apps. https://msdn.microsoft.com/en-us/library/office/dn911482.aspx

Answering the specific question:

How to check if file (image, xls, doc or any other) can be opened to edit?

You can use the UIApplication method called canOpenURL to check if the current device responds to a specific URLScheme and if it does, you can call the app to edit you file. The same can be applied to other apps that you want to open. You just need to see if the app have URLScheme support.

Remembering that in iOS 9 you need to add the URLs you want to call during the app life in the Info.plist. Otherwise, the canOpenURL method will always returno NO.

This code illustrates the approach. However, it is to search some navigation apps. Just like tapping a shared friend location in WhatsApp.

https://snipt.net/wallaaa/using-url-schemes/

The result:

这篇关于添加“在Excel中编辑”或“编辑照片”延期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆