如何安装 SDWebImage [英] How to install SDWebImage

查看:44
本文介绍了如何安装 SDWebImage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的应用程序中管理照片,并且阅读了很多关于 SDWebImage 框架的信息,这似乎是最好的方法.但是我发现安装起来非常困难.我不了解 Ruby,也从未使用过 podfile,所以我通过下载最新的 SDWebImagefolder & 来安装它.框架并将它们添加到我的项目中.但是,当我尝试使用建议的导入导入视图控制器时:

I need to manage photos in my app and have read much about SDWebImage framework which seems to be the best way to go. However I am finding it incredibly difficult to install. I dont know Ruby and have never used a podfile, so am installing it by downloading the latest SDWebImagefolder & framework and adding them to my project. However when I try to import into my viewcontroller using the suggested imports:

#import <SDWebImage/UIImageView+WebCache.h>
#import "UIImageView+WebCache.h"

我在#import 上找不到一个文件,然后如果我按照建议将其更改为SDWebImage/UIImageView+WebCache.h",我会在以下位置找到一个文件:#import UIImageView+WebCache.h,即使我在我的项目中打开SDWebImage文件夹时可以清楚地看到它!当我尝试使用 sd_setImageWithUrl 方法时,我猜测这些错误也会导致未找到错误.

I get a file not found with on the #import then if I change this to "SDWebImage/UIImageView+WebCache.h" as suggested I get a file not found on the: #import UIImageView+WebCache.h even though I can clearly see it when I open the SDWebImage folder in my project! I'm guessing that these errors also lead to a not found error when I try to use the sd_setImageWithUrl method.

这是我的项目的屏幕截图:

Here's a screen shot of my project:

我希望我能得到一些帮助,因为框架看起来有很好的功能.非常感谢任何帮助.谢谢

I hope I can get some help with this as the framework looks to have very good functionality. Any help very much appreciated. Thanks

推荐答案

当您在项目中添加 SDWebImage 文件夹时,请选择以下选项.将文件夹的副本添加到目标项目并创建组.

When you add the SDWebImage folder in your project then select following option. To add copy of your folder to the destination project and Create groups.

然后你必须像这样写

#import "UIImageView+WebCache.h"

并确保添加到所有要使用该库的目标.

And make sure that you are adding to all the targets that you want to use that library.

Github 上的文档:

将 SDWebImage 项目添加到您的项目中

Add the SDWebImage project to your project

  • 从下载页面下载并解压最新版本的框架
  • 右键单击项目导航器并选择将文件添加到您的项目":
  • 在对话框中,选择 SDWebImage.framework:
  • 选中将项目复制到目标组的文件夹(如果需要)"复选框

或者您可以使用 cocoa pods 作为其他答案建议.

Or you can use cocoa pods as other answer suggested.

[self.imageView sd_setImageWithURL:[NSURL URLWithString:"yoururl.png"] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];

这篇关于如何安装 SDWebImage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆