loading-buttons-ios icon indicating copy to clipboard operation
loading-buttons-ios copied to clipboard

I am using this pod by assign loading button class in storyBoard but some time loading progress indicator not end And other issue which I am facing when click on button progress indicator start but button title not removed

Open waqarali462 opened this issue 3 years ago • 6 comments

Start loading in GoogleMap function

extension homeViewController: GMSMapViewDelegate
{
    func mapView(_ mapView: GMSMapView, idleAt position: GMSCameraPosition) {
        
        if self.textFieldname == "pickup"
        {
            if confirmPickUpbtn.isLoading
            {
                
            }
            else
            {
                confirmPickUpbtn.isLoading = true
                confirmPickUpbtn.showLoader(userInteraction: false)
            }
            
            
        }
        else if self.textFieldname == "dropoff"
        {
            if confirmDropoffbtn.isLoading
            {
                
            }
            else
            {
                confirmDropoffbtn.isLoading = true
                confirmDropoffbtn.showLoader(userInteraction: false)
            }
             
        }
        //        let camera = GMSCameraPosition.camera(withLatitude: (position.target.latitude), longitude: (position.target.longitude), zoom: 18.0 , bearing: 0, viewingAngle: 0)
        //        self.mapView?.animate(to: camera)
        reverseGeocodeCoordinate(position.target)
        
    }
}

End in reverseGeocodeCoordinate function

    private func reverseGeocodeCoordinate(_ coordinate: CLLocationCoordinate2D) {
        
        // 1
        let geocoder = GMSGeocoder()
        
        // 2
        geocoder.reverseGeocodeCoordinate(coordinate) { response, error in
            guard let address = response?.firstResult(), let lines = address.lines else {
                return
            }
            
            // 3
            if self.textFieldname == "pickup"
            {
               ###  if self.confirmPickUpbtn.isLoading
                {
                    self.confirmPickUpbtn.isLoading = false
                    self.confirmPickUpbtn.hideLoader()
                    self.confirmPickUpbtn.backgroundColor = UIColor(hexString: "#FFCF00")
                }
                current_lat = coordinate.latitude
                current_long = coordinate.longitude
                self.startLocTextF.text = lines.joined(separator: "\n")
                self.locationManager.stopUpdatingLocation()
            }
            else if self.textFieldname == "dropoff"
            {
                if self.confirmDropoffbtn.isLoading
                {
                    self.confirmDropoffbtn.isLoading = false
                    self.confirmDropoffbtn.hideLoader()
                    self.confirmDropoffbtn.backgroundColor = UIColor(hexString: "#FFCF00")
                }
                desition_lat = coordinate.latitude
                desition_long = coordinate.longitude
                self.endLocTextF.text = lines.joined(separator: "\n")
                self.locationManager.stopUpdatingLocation()
                
            }
            
            
            // 4
            UIView.animate(withDuration: 0.25) {
                self.view.layoutIfNeeded()
            }
        }
    }

Button Action code

@IBAction func conformpickup(_ sender: LoadingButton) {
        sender.isLoading ? sender.hideLoader() : sender.showLoader(userInteraction: true)
        DispatchQueue.main.async {
            self.confirmPickUpbtn.backgroundColor = UIColor(hexString: "#FFCF00")
        }
}

waqarali462 avatar Nov 19 '20 07:11 waqarali462

Hi, I need more context on how to reproduce the bug so I can help with it. E.g., you need to provide the version you're using, and what actions you take to make the issue happens.

twho avatar Nov 20 '20 06:11 twho

0.1 i am using this version

On Fri, Nov 20, 2020 at 11:02 AM Michael T. Ho [email protected] wrote:

Hi, I need more context on how to reproduce the bug so I can help with it. E.g., you need to provide the version you're using, and what actions you take to make the issue happens.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/twho/loading-buttons-ios/issues/9#issuecomment-730871965, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARPRT56IKPJ3OAWBIZHMJM3SQYA57ANCNFSM4T3BK6PA .

waqarali462 avatar Nov 26 '20 09:11 waqarali462

And how to reproduce the bug? I won't be able to help you without enough information

twho avatar Nov 26 '20 21:11 twho

Is this issue got resolved ? I am facing the similar issue.

kannanprasad87 avatar Apr 09 '21 00:04 kannanprasad87

Steps to reproduce:

  1. Add a UIButton in Storyboard and set custom class in identity inspector.
  2. Set title and other IBInspectable properties.
  3. In the code set the indicator style.
  4. On a button action try to animate, animation started but the label remains visible.
  5. I have debugged the code - its trying to set alpha value to zero for the button label and image but didn't reflected.

Xcode used :12.4 iOS version : 14.3

kannanprasad87 avatar Apr 09 '21 00:04 kannanprasad87

I will add a storyboard version in the demo app, hopefully I'll catch this bug

twho avatar May 26 '21 19:05 twho