//
// ViewController.swift
// SK_Kingfisher
//
// Created by coder on 2019/3/6.
// Copyright © 2019 AlexanderYeah. All rights reserved.
//
import UIKit
import Kingfisher
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let imgViewA = UIImageView(frame: CGRect(x: 100, y: 200, width: 150, height: 150));
self.view.addSubview(imgViewA);
// 最为简单的使用方式
let url = URL(string: "http://t2.hddhhn.com/uploads/tu/201610/198/scx30045vxd.jpg");
// 等待指示器
imgViewA.kf.indicatorType = .activity;
// 展示的方式fadein
imgViewA.kf.setImage(with: url,options:[.transition(.fade(0.5))]);
// 设置超时时间
let downloader = KingfisherManager.shared.downloader;
// 超时时间
downloader.downloadTimeout = 1;
// 获取缓存代销
let cache = KingfisherManager.shared.cache;
// 设置最大缓存为多少 100M 默认是无上限
cache.maxMemoryCost = 100 * 1024 * 1024;
// 设置保存时间 1天 默认一周
cache.maxCachePeriodInSecond = 1 * 60 * 60 * 24;
}
}
Swift-Kingfisher的简单使用
最新推荐文章于 2025-10-04 07:31:44 发布
部署运行你感兴趣的模型镜像
您可能感兴趣的与本文相关的镜像
Seed-Coder-8B-Base
文本生成
Seed-Coder
Seed-Coder是一个功能强大、透明、参数高效的 8B 级开源代码模型系列,包括基础变体、指导变体和推理变体,由字节团队开源
882

被折叠的 条评论
为什么被折叠?



