We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked.
Custom Indicator is not centred like default indicator type
The custom indicator UIView shows up on top left side of the corner always
import UIKit import Kingfisher class BounceLoader: UIView { var outerCirlce: UIView = UIView() var innerCircle: UIView = UIView() let transformOne = CGAffineTransform(scaleX: 0.01, y: 0.01) let transformTwo = CGAffineTransform(scaleX: 1.6, y: 1.6) override init(frame: CGRect) { super.init(frame: frame) commonInit() } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) commonInit() } func commonInit() { self.backgroundColor = UIColor.clear outerCirlce.frame = bounds innerCircle.frame = bounds makeUIViewCircle(view: outerCirlce) makeUIViewCircle(view: innerCircle) makeUIViewTranslucent(view: outerCirlce, blurStyle: .dark) makeUIViewTranslucent(view: innerCircle, blurStyle: .light) addSubview(outerCirlce) addSubview(innerCircle) startAnimation() } private func makeUIViewCircle(view: UIView) { view.layer.cornerRadius = view.frame.width/2 } private func makeUIViewTranslucent(view: UIView, blurStyle: UIBlurEffectStyle) { view.backgroundColor = UIColor.clear let blurEffect = UIBlurEffect(style: blurStyle) let uiVisualEffect = UIVisualEffectView(effect: blurEffect) uiVisualEffect.frame = view.bounds uiVisualEffect.autoresizingMask = [.flexibleWidth, .flexibleHeight] view.clipsToBounds = true view.addSubview(uiVisualEffect) } func startAnimation() { self.isHidden = false UIView.animate(withDuration: 0.6, delay: 0.0, options: [.autoreverse,.repeat,.curveEaseOut,.beginFromCurrentState,.preferredFramesPerSecond60], animations: { [weak self] in guard let `self` = self else { return } self.innerCircle.transform = self.transformOne self.outerCirlce.transform = self.transformTwo }, completion: nil) } func stopAnimation(){ self.isHidden = true } }
struct MyIndicator: Indicator { let loader = BounceLoader(frame: CGRect(x: 0.0, y: 0.0, width: 30.0, height: 30.0)) var view: IndicatorView { return loader } func startAnimatingView() { loader.startAnimation()() } func stopAnimatingView() { loader.stopAnimation() } }
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: photoViewCellIdentifier, for: indexPath) as! PhotoCollectionViewCell let url = URL(string: photo.urls.regular) cell.photoImageView.backgroundColor = UIColor.hexStringToUIColor(hex: photo.color) cell.photoImageView.kf.indicatorType = .custom(indicator: MyIndicator()) cell.photoImageView.kf.setImage(with: url , options: [.transition(.fade(0.4))]) return cell
The text was updated successfully, but these errors were encountered:
I think I found an issue in setting indicator frame. I pushed a fix on it. could you try whether it could work for you? See here: #798
Sorry, something went wrong.
This issue is not solved in current version 4.7.0
No branches or pull requests
Check List
Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked.
Issue Description
Custom Indicator is not centred like default indicator type
What
The custom indicator UIView shows up on top left side of the corner always
Reproduce
Here is the relevant code
BounceLoader.swift
MyIndicator.swift
ViewController.swift
The text was updated successfully, but these errors were encountered: