CocoPods安装SDWebImage

本文介绍了如何使用CocoaPods安装SDWebImage库,并详细探讨了WebP图片格式的优势,包括压缩效果、兼容性和可用性。通过实验数据展示了WebP在图片质量和体积之间的平衡,提供了关于WebP在不同场景下的应用和优化建议。
摘要由CSDN通过智能技术生成

github挂载地址:https://github.com/rs/SDWebImage


Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects. See the Get Started section for more details.

Podfile
platform :ios, '6.1'
pod 'SDWebImage', '~>3.7'

If you are using Swift, be sure to add use_frameworks! and set your target to iOS 8+:

platform :ios, '8.0'
use_frameworks!
Subspecs

There are 3 subspecs available now: CoreMapKit and WebP (this means you can install only some of the SDWebImage modules. By default, you get just Core, so if you need WebP, you need to specify it). 

Podfile example:

pod 'SDWebImage/WebP'

Installation with Carthage (iOS 8+)

Carthage is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods.

To install with carthage, follow the instruction on Carthage

Cartfile
github "rs/SDWebImage"
Usage

Swift

If you installed using CocoaPods:

import SDWebImage

If you installed manually:

import WebImage

Objective-C

@import WebImage;

Installation by cloning the repository

In order to gain access to all the files from the repository, you should clone it.

git clone --recursive https://github.com/rs/SDWebImage.git

Add the SDWebImage project to your project

  • Download and unzip the last version of the framework from the download page
  • Right-click on the project navigator and select "Add Files to "Your Project":
  • In the dialog, select SDWebImage.framework:
  • Check the "Copy items into destination group's folder (if needed)" checkbox

Add dependencies

  • In you application project app’s target settings, find the "Build Phases" section and open the "Link Binary With Libraries" block:
  • Click the "+" button again and select the "ImageIO.framework", this is needed by the progressive download feature:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值