gpt4 book ai didi

ios - 我如何在 Storyboard中使用 pdf 作为图像?

转载 作者:行者123 更新时间:2023-11-28 22:20:20 25 4
gpt4 key购买 nike

我想显示一张图片。我知道的简单方法是:在界面上放置一个 ImageView ,然后选择属性检查器并输入我的文件名(对于放入我的项目的文件)。这适用于我的图片的 png 版本。

但我想在这里使用 pdf 文件。是否可以?在屏幕上显示我的 pdf 文件的最佳方式是什么?

最佳答案

显示 PDF 的最佳选择是在 Web View 中。像添加 ImageView 一样添加 WebView ,并将 socket 连接到它。然后,在代码中,当显示 View 时,调用:

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"MyPDF" ofType:@"pdf"];
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:filePath]]];

关于ios - 我如何在 Storyboard中使用 pdf 作为图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20584567/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com