ios dropbox,在表视图中加载图像的缩略图

发布于 2025-01-06 01:18:32 字数 165 浏览 2 评论 0原文

我的保管箱中有图片,我需要在 Uitable 视图中显示它。我能够使用元数据文件元数据按名称显示图片,当我单击任何单元格时,我可以通过调用 loadthumbnail 成功地在图像视图中查看图像。 但现在,我想将图像的缩略图与图像名称一起显示,以便用户在打开图像之前了解图像。 那么,有什么简单的方法可以做到这一点。

I have picture in my dropbox, which i need to show in Uitable view. I am able to show the picture by name, using metadata filemetadata, and when i click on any of cell i am successfully able to view the image in image view, by using the call to loadthumbnail.
But now, I want to show the thumbnail of image together with, image name, so that user have idea of image before opening it.
So, what is the simple way of doing it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

岁月染过的梦 2025-01-13 01:18:32

您应该在显示 UITableView 之前调整(拇指)原始 UIImage 的大小,并将其保存在您的应用缓存文件夹中。

像这样的东西(从我的头顶出来)

CGSize targetSize = (CGSize){ 100, 80 };
UIGraphicsBeginImageContext(targetSize);

CGRect thumbnailRect = (CGRect){ 0, 0, targetSize.width, targetSize.height };

[sourceImage drawInRect:thumbnailRect];    
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

// After this you should store the UIImage (NSData) as a file, so you could use it later on.

You should resize (thumb) the original UIImage's prior to showing the UITableView and save them in your app cache folder.

Something like this (out the top of my head)

CGSize targetSize = (CGSize){ 100, 80 };
UIGraphicsBeginImageContext(targetSize);

CGRect thumbnailRect = (CGRect){ 0, 0, targetSize.width, targetSize.height };

[sourceImage drawInRect:thumbnailRect];    
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

// After this you should store the UIImage (NSData) as a file, so you could use it later on.
独﹏钓一江月 2025-01-13 01:18:32

尝试转到“开始”菜单,然后查找“我的文档”并查找名为“下载”的文件夹。这对我无法看到的下载有用。

祝你好运!

Try to go to the Start Menu then look for My Documents and look for a folder named Downloads. This worked for me on a download i could not see.

Good Luck!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文