简体   繁体   English

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

[英]ios dropbox, loading thumbnail of image in table view

I have picture in my dropbox, which i need to show in Uitable view.我的保管箱中有图片,需要在 Uitable 视图中显示。 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.我可以使用元数据文件元数据按名称显示图片,并且当我单击任何单元格时,我可以通过调用 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.那么,这样做的简单方法是什么。

You should resize (thumb) the original UIImage 's prior to showing the UITableView and save them in your app cache folder.您应该在显示UITableView之前调整(拇指)原始UIImage的大小并将它们保存在您的应用程序缓存文件夹中。

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.

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!祝你好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM