我正在为网站开发一个包装器应用程序.基本上,它在UIWebView中打开网站的移动版本.网站上的某些链接指向PDF.
当在Safari中打开相同的站点并点击PDF链接时,在PDF上显示带有"在iBooks中打开"的漂亮黑条纹.如下图所示:

我怎么能在我的应用程序中实现相同的条纹?
编辑:
我不是在询问如何在半透明背景上创建黑色按钮.
我有兴趣重现整个工作流程:
Gia*_*one 24
要检查iBooks是否已安装,您可以致电:
BOOL iBooksInstalled = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"ibooks://"]];
Run Code Online (Sandbox Code Playgroud)
您可以使用以下内容显示应用程序列表(为什么仅限于iBooks?;)):
//use the UIDocInteractionController API to get list of devices that support the file type
NSURL *pdfURL = // your pdf link.
UIDocumentInteractionController *docController = [UIDocumentInteractionController interactionControllerWithURL:pdfURL];
//present a drop down list of the apps that support the file type, click an item in the list will open that app while passing in the file.
[docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
Run Code Online (Sandbox Code Playgroud)
请注意,这不适用于iOS模拟器,除非您创建了一个阅读PDF的应用程序!
如果您真的只想让选项让我们在iBooks中打开PDF,您可能想尝试将文件的URL附加到@"ibooks://"方案或iBooks提供的其他两种方案之一(它适用于iBook商店中的书籍,但我不确定它是否适用于其他网址)@"itms-books://"和@"itms-bookss://".然后你可以这样做:
NSURL *iBooksURLScheme = [NSURL URLWithString:@"ibooks://"];
NSString *fileURLString = // your file URL as *string*
NSURL *finalURL = [iBooksURLScheme URLByAppendingPathComponent:fileURLString];
[[UIApplication sharedApplication] openURL:finalURL];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10018 次 |
| 最近记录: |