有没有办法改变色调/背景颜色UIDocumentInteractionController navigationbar?

在我的应用程序中,我允许用户通过Instagram共享照片,这需要使用UIDocumentInteractionController.如果手机支持,则会自动检测到Airdrop.如何从"打开方式"操作表中删除它?
即使我使用UIActivityViewController开始共享过程并调用setExcludedActivityTypes:,最终我必须使用UIDocumentInteractionController,当我这样做时,Airdrop再次出现.以下是分享按钮时的代码:
NSURL *instagramURL = [NSURL URLWithString:@"instagram://location?id=1"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:@"Image.igo"];
NSData *imageData = UIImagePNGRepresentation(imageToShare);
[imageData writeToFile:savedImagePath atomically:YES];
NSURL *imageUrl = [NSURL fileURLWithPath:savedImagePath];
docController = [[UIDocumentInteractionController alloc] init];
docController.UTI = @"com.instagram.exclusivegram";
docController.URL = imageUrl;
[docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
}
else
{
NSLog(@"no insta");
}
Run Code Online (Sandbox Code Playgroud) 我目前正在开发一个专门针对iOS7的应用程序,它利用菜单中打开的UIDocumentInteractionController,需要一个方法,当用户取消并且不选择可用选项时通知我.
UIDocumentInteractionControllerDelegate提供:
- (void)documentInteractionControllerDidDismissOptionsMenu:(UIDocumentInteractionController *) controller
Run Code Online (Sandbox Code Playgroud)
但这并未指定用户是否点按了其中一个可用选项或取消.
有任何想法吗?
我可以使用,在Instagram上成功分享图像UIDocumentInteractionController,但InstagramCaption密钥不起作用.这是我的代码:
self.controller = UIDocumentInteractionController()
// controller.delegate = self
self.controller.URL = fileUri
// HERE, the caption won't appear.
self.controller.annotation = NSDictionary(objectsAndKeys: "my caption", "InstagramCaption")
self.controller.UTI = "com.instagram.exclusivegram"
self.controller.presentOpenInMenuFromRect(CGRectZero, inView: self.view, animated: true)
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
是否可以绕过行动共享表将照片分享给Instagram?
请注意,我知道的UIDocumentInteractionController和挂钩,事实上它工作正常.通过他们的示例代码,您可以获得一个Copy to Instagram选项(如果您使用独家UTI或可以处理JPG/PNG的大量应用程序,以及Instagram,则可以选择).
这很好,但我想知道是否有办法执行"复制到Instagram"操作,而无需UIDocumentInteractionController在iOS 9+中显示菜单.
为了记录,这是完美运行的代码的简化版本.假设你有一个有效的NSURL ......
guard let data: NSData = NSData(contentsOfURL: url),
image = UIImage(data: data) else {
return
}
let imageData = UIImageJPEGRepresentation(image, 100)
let captionString = "caption"
let writePath = (NSTemporaryDirectory() as NSString).stringByAppendingPathComponent("instagram.ig")
guard let _ = imageData?.writeToFile(writePath, atomically: true) else {
return
}
let fileURL = NSURL(fileURLWithPath: writePath)
self.documentController = UIDocumentInteractionController(URL: fileURL)
self.documentController.delegate = self
self.documentController.UTI = "com.instagram.photo"
self.documentController.annotation = NSDictionary(object: captionString, forKey: "InstagramCaption") …Run Code Online (Sandbox Code Playgroud) 问题:
理解:
数据流:
我试图利用启动选项键没有运气.
简而言之,我似乎无法理解:
最终结果:我试图远离
文档交互文档概述:
这是我最感兴趣的" 从其他应用程序打开文件 ".它指示我通过传入键的字典值来使用应用程序:didFinishLaunchingWithOptions:方法.这是我迷路的地方?如何设置密钥以使其知道要查找的"WHERE"和"WHAT"?我仍然不清楚App1应该保存信息的正确导演,以便键指向正确的位置?
在iBooks中打开电子邮件文件附件和打开pdf不是唯一可以使用此API的地方,否则Apple将无法完成所有工作,他们已经允许从App-To-App进行通话.
如果有人有一个示例应用程序,教程,甚至一个坚实的想法如何让这个工作,我真的很感激帮助.
-谢谢!
PS有1,500或更高信誉的人请为stackoverflow创建一个"UIDocumentInteraction"标签!
我正在尝试为我的iOS应用程序创建/导出独有的UTI类型(非常类似于Instagram独家处理UTI com.instagram.exclusivegram的方式).
基本上,我想com.photoapp.photo是一个应用程序可以使用,如果他们希望能够在任何注册拍照的应用程序中打开照片(类似于Instagram的com.instagram.photo).然后我想com.photoapp.exclusive只能在我的应用程序中打开(类似于com.instagram.exclusivegram).
我在设备上遇到的是即使使用com.photoapp.exclusive,UIDocumentController也会提示我在PhotoApp或DropBox中打开它,它应该只是PhotoApp.
我有我的应用程序注册UTI以及我用来检查开放能力的示例应用程序.我在示例应用程序中使用的代码如下:
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"photoapp://"]]) {
NSData *imageData = UIImageJPEGRepresentation([UIImage imageNamed:@"derp.png"], 1.0);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *fullPathToFile = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"photoapp.pae"];
[imageData writeToFile:fullPathToFile atomically:NO];
interactionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:[NSString stringWithFormat:@"file://%@", fullPathToFile]]];
interactionController.UTI = @"com.photoapp.exclusive";
interactionController.delegate = self;
[interactionController presentOpenInMenuFromRect:self.view.frame inView:self.view animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
以下是我的app文件中的plist文件:
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeDescription</key>
<string>Exclusive PhotoApp Photo</string>
<key>UTTypeConformsTo</key>
<array>
<string>com.photoapp.photo</string>
</array>
<key>UTTypeIdentifier</key>
<string>com.photoapp.exclusive</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>pae</string>
</dict>
</dict>
<dict>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>pa</string>
</dict>
<key>UTTypeIdentifier</key>
<string>com.photoapp.photo</string>
<key>UTTypeDescription</key>
<string>PhotoApp …Run Code Online (Sandbox Code Playgroud) 我想Calendar在我的内部打开一个ics()文件iOS application.
出于调试目的,我已将iics文件添加到我在iCal中创建的日历事件包中.
我UIDocumentInteractionController用来呈现日历邀请的数据,希望让用户将其添加到他们的日历中.
但是,在将UIDocumentInteractionControlleronics作为源文件时,它会正确显示与事件相关的所有数据,但是"添加到calendar" 按钮将替换为" 此邀请数据已过期 "
如果我使用共享选项通过短信或电子邮件发送文件,然后尝试打开它,它按预期使用UIDocumentInteractionController,因此我不认为它是一个损坏的文件.
我想知道我是否遗漏了一些简单的东西,UIDocumentInteractionController或者这是一个已知的问题.
任何想法都会很棒
self.documentController = [UIDocumentInteractionController
interactionControllerWithURL:[NSURL fileURLWithPath:filePath]];
self.documentController.delegate = self;
[self.documentController presentPreviewAnimated:YES];
Run Code Online (Sandbox Code Playgroud)
编辑:我不能使用EKEvents,因为我需要将被邀请者添加到活动中
我正在通过它与其他应用共享PDF UIDocumentInteractionController.在添加此功能之前,我有一个自定义的"发送到电子邮件"按钮使用MFMailComposeViewController- 但现在我还有一个邮件按钮UIDocumentInteractionController,我想使用它,以避免重复按钮.
我的问题是,通过旧邮件控制器,我曾经设置主题和内容文本,而如果我使用UIDocumentInteractionController- 我只收到一封带有PDF附件的空白电子邮件.有没有人知道我可以解决这个问题,并在使用时获取我的自定义主题和内容UIDocumentInteractionController?
我在文档中找不到任何明显的东西,显然我不能干涉Mail应用程序以使其与我的应用程序通信 - 但是想知道是否有其他人遇到过这个问题,并且怀疑是"后门"解决方案.
以下是我目前正在创建和初始化我的代码UIDocumentInteractionController:
-(void)openDocumentIn:(NSString*)filepath
{
//NSString * filePath = [[NSBundle mainBundle]
pathForResource:filePath ofType:@"pdf"];
documentController = [UIDocumentInteractionController
interactionControllerWithURL:[NSURL fileURLWithPath:filepath]];
documentController.delegate = self;
documentController.UTI = @"com.adobe.pdf";
[documentController presentOptionsMenuFromBarButtonItem:
[self.imageViewController exportQuote] animated:YES];
}
Run Code Online (Sandbox Code Playgroud) ios ×8
instagram ×4
cocoa-touch ×3
objective-c ×3
ios4 ×2
ios7 ×2
iphone ×2
swift ×2
airdrop ×1
database ×1
icalendar ×1
sharing ×1
uidocument ×1
uti ×1
xcode ×1