Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/103.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何使用翠鸟为UIButton设置setBackgroundImage期间的indicatorType_Ios_Swift_Kingfisher - Fatal编程技术网

Ios 如何使用翠鸟为UIButton设置setBackgroundImage期间的indicatorType

Ios 如何使用翠鸟为UIButton设置setBackgroundImage期间的indicatorType,ios,swift,kingfisher,Ios,Swift,Kingfisher,在翠鸟文档中,有关于为常规imageView设置图像时设置指示类型的信息: imageView.kf.indicatorType = .activity imageView.kf.setImage(with: url) 但在为UIButton设置背景图像时,如何设置indicatorType myButton.kf.setBackgroundImage(with: url, for: .normal) 没有直接的方法 但您可以这样做,创建带有指示器的自定义ui按钮 那

在翠鸟文档中,有关于为常规imageView设置图像时设置指示类型的信息:

    imageView.kf.indicatorType = .activity
    imageView.kf.setImage(with: url)
但在为UIButton设置背景图像时,如何设置indicatorType

    myButton.kf.setBackgroundImage(with: url, for: .normal)

没有直接的方法

但您可以这样做,创建带有指示器的自定义
ui按钮
那样

然后像这样使用

let btn = LoadingButton()
    btn.showLoading()
    btn.kf.setBackgroundImage(with: URL(string: ""), for: .normal) { (image, error, cachType, url) in
      btn.hideLoading()
    }