valentinjahanmanesh/loady

when start in viewdidload,button image will not show

yeziahehe opened this issue · 5 comments

when start in viewdidload,button image will not show

class ViewController: UIViewController {
    var tempTimer1 : Timer?
    @IBOutlet var fillingView : LoadyButton!

    override func viewDidLoad() {
        super.viewDidLoad()
        
        // start and stop animating on user touch
        self.fillingView.setAnimation(LoadyAnimationType.backgroundHighlighter())
        self.fillingView.startLoading()
        var percent : CGFloat = 100
        if #available(iOS 10.0, *) {
            self.tempTimer1 = Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { (t) in
                percent -= 10
                self.fillingView.update(percent: percent)
                if percent <= 0 {
                    percent = 0
                    self.tempTimer1?.invalidate()
                }
            }
        }
        self.tempTimer1?.fire()
    }
    
    @IBAction func animateView(_ sender : UIButton){
        guard let button = sender as? LoadyButton else {
            return
        }
        if button.loadingIsShowing() {
            button.stopLoading()
            return
        }
    }
}

hello i will investigate it soon

Screen Shot 2019-12-31 at 1 33 28 AM

have you set your button's image in interface builder? because I checked it and everything was ok

Yes, button is created by storyboard

thank you for reporting this bug, It was some weird issue that new layer covers the button's image view. I don't know if it is a swift bug or it is as intended to be, but I have fixed it in 1.0.5, you can do a pod update.

and I apologize for my delay, we are in the middle of a release and we are working hard to meet the deadline, so I couldn't put enough effort to solve this sooner.

You solve it in time and thank for your contribution to open source.