地址:https://github.com/onevcat/Kingfisher

platform :ios, '9.0'
use_frameworks!target 'videowallpaper' dopod 'Kingfisher'pod 'Alamofire'pod 'SwiftyJSON'pod 'Dollar'pod 'SnapKit'pod 'Kingfisher'
end

最简单的用法,直接加载图片

//
//  ViewController.swift
//  videowallpaper
//
//  Created by liuan on 2020/6/11.
//  Copyright © 2020 liuan. All rights reserved.
//import UIKit
import Kingfisherclass ViewController: UIViewController {override func viewDidLoad() {super.viewDidLoad()// Do any additional setup after loading the view.let uiLableHeight:CGFloat = 60let uiLabel = UILabel(frame: CGRect(x: 0, y: 0, width: view.bounds.width, height:uiLableHeight))uiLabel.backgroundColor = .greenuiLabel.text = "猴头客公众号"let imageViewHeight = view.bounds.height - uiLableHeightlet imageView = UIImageView(frame: CGRect(x: 0, y: uiLableHeight, width: view.bounds.width, height: imageViewHeight))view.addSubview(uiLabel)view.addSubview(imageView)let url = URL(string: "https://www.houtouke.com/wp-content/uploads/2019/08/qrcode_for_gh_1dd5f06ca86b_258-1.jpg")imageView.kf.setImage(with: url)}}

缓存加载图片,并设置默认图

//
//  ViewController.swift
//  videowallpaper
//
//  Created by liuan on 2020/6/11.
//  Copyright © 2020 liuan. All rights reserved.
//import UIKit
import Kingfisherclass ViewController: UIViewController {override func viewDidLoad() {super.viewDidLoad()// Do any additional setup after loading the view.let uiLableHeight:CGFloat = 60let uiLabel = UILabel(frame: CGRect(x: 0, y: 0, width: view.bounds.width, height:uiLableHeight))uiLabel.backgroundColor = .greenuiLabel.text = "猴头客公众号"let imageViewHeight = view.bounds.height - uiLableHeightlet imageView = UIImageView(frame: CGRect(x: 0, y: uiLableHeight, width: view.bounds.width, height: imageViewHeight))view.addSubview(uiLabel)view.addSubview(imageView)let url = URL(string: "https://www.houtouke.com/wp-content/uploads/2019/08/qrcode_for_gh_1dd5f06ca86b_258-1.jpg")//        imageView.kf.setImage(with: url)imageView.kf.indicatorType = .activityimageView.kf.setImage(with:url,placeholder: UIImage(named: "logo_80"),options: [.processor(RoundCornerImageProcessor(cornerRadius: 100)),.scaleFactor(UIScreen.main.scale),.cacheOriginalImage])}}

swift kingfisher 加载图片相关推荐

  1. 写一个可以使用kingfisher加载图片的轮播器PPTView

    前言:关于图片轮播的第三方资源已经很多了,其中大多的使用都是很简单方便的, 但是从oc到swift上面来, 就写一写基本的常用的"控件"当作熟悉吧, 如果在这个过程中能帮到一些正在 ...

  2. Kingfisher加载不出带逗号的图片url

    问题说明 有的网络图片链接中有逗号, 使用kingfisher 加载不出来. http://img3.imgtn.bdimg.com/it/u=3731532511,3143059206&fm ...

  3. 原生CSS设置预加载图片之前的默认背景图

    /*默认加载图片*/ .class-name { /*背景图片*/background: url(../../img/banner/banner-default.jpg) no-repeat cent ...

  4. 【Qt】QPixmap加载图片报错:Corrupt JPEG data: premature end of data segment Didn‘t expect more than one scan

    1.问题描述 在使用QPixmap加载图片时失败,错误信息如下 Corrupt JPEG data: premature end of data segment Didn't expect more ...

  5. 13-flutter 加载图片

    Image Widget 1 flutter 加载图片的方式 new Image 从ImageProvider 中获取图像 new Image.asset 使用key 从assetBundle 获取图 ...

  6. html5 canvas 加载图片

    html5 canvas 加载图片 视频 https://www.bilibili.com/video/BV19E411G7Vj?p=30 https://www.bilibili.com/video ...

  7. qt快速加载图片_Qt实用技巧:使用Qt加载超大图片的耗时测试

    需求 某机器人项目中,需要加载构建的地图,此处仅测试直接加载图片的时间. 相关博客 测试代码 QString path; path = "./map/1.png"; QFileIn ...

  8. Android实现ListView异步加载图片

    转: http://www.iteye.com/topic/685986 ListView异步加载图片是非常实用的方法,凡是是要通过网络获取图片资源一般使用这种方法比较好,用户体验好,下面就说实现方法 ...

  9. 【第二篇】Volley的使用之加载图片

    Volley加载图片有两种方式: 1,ImageRequest 来对网络图片进行请求,放入请求队列,获取后现在在控件上面. 2,NetworkImageView 最为自定义控件来自动加载网络图片. 3 ...

最新文章

  1. linux date英文时间,date(时间),timedatectl(时区),cal(日历)的用法
  2. zabbix 安装时常见问题处理
  3. FreeRtos学习笔记(11)查找就绪任务中优先级最高任务原理刨析
  4. qt mysql数据库连接池_qt中使用数据库连接池
  5. pdflush内核线程池及其中隐含的竞争
  6. ubuntu 13.04 mysql_Ubuntu13.04 下MySQL5.6安装过程
  7. rmi远程反序列化rce漏洞_Apache Dubbo Provider默认反序列化远程代
  8. 马斯克说,特斯拉卡车有Mad Max狂野模式,危险的变道操作?
  9. C# 新特性 操作符单?与??和 ?. 的使用
  10. 数据库数据迁移的3种方案学习
  11. paypal支付开发接口(转)
  12. 【微积分的本质|笔记】指数函数求导
  13. python输入用户名和密码_验证Python中的用户名和密码输入
  14. Docker系列之八:在Dockerfile中使用多段构建Muti-stage build
  15. 机器学习之中文处理:文言文还是白话文
  16. 什么是触发器,MySQL都有哪些触发器?
  17. solidworks模型如何进行1/4剖面
  18. 百度地图鹰眼轨迹服务web服务API应用
  19. android获取当前系统语言
  20. Set是如何不能加入重复值

热门文章

  1. 2022年A特种设备相关管理(电梯)考题模拟考试平台操作
  2. 龚虹嘉:中国最优秀的天使投资人
  3. 知名天使投资人列出愿意投资的30大创意方向
  4. python使用fpdf生成pdf文件并添加页眉和页脚
  5. 定义枚举类型,输出三角形的形状
  6. Matlab系列之信号调制
  7. MySQL查询每个部门的员工个数(部门员工数可能为0)
  8. EasyExcel 设置单元格格式为 文本
  9. 关于SuperSlide的使用方法 以及 调用属性参数的介绍
  10. x509: cannot validate certificate because of not containing any IP SANs