HHFloatingView icon indicating copy to clipboard operation
HHFloatingView copied to clipboard

How to change Handler image when we click on it

Open krutitrivedi opened this issue 4 years ago • 2 comments

hello, I want to change background of handler when we click on it i tried this way but not working can you please help me out and also i want transparent background when we click on handler also please guid me on how to achieve that functionality.

func floatingView(floatingView: HHFloatingView, didTapHandler isOpening: Bool) {
       let configure = HHFloatingViewConfiguration()
       if isOpening == true {
           configure.handlerImage = #imageLiteral(resourceName: "closeFloting")
           configure.handlerColor = UIColor.white
           
       }
       else {
           
          configure.handlerImage = #imageLiteral(resourceName: "FloatingButton")
          configure.handlerColor = UIColor(red: 47/255.0, green: 89/255.0, blue: 246/255.0, alpha: 
       }
   }

krutitrivedi avatar Feb 27 '20 09:02 krutitrivedi

I'm out of my desk currently. Can you get back to you over the weekends.

On Thu, 27 Feb 2020 at 15:12, krutitrivedi [email protected] wrote:

hello, I want to change background of handler when we click on it i tried this way but not working can you please help me out and also i want transparent background when we click on handler also please guid me on how to achieve that functionality.

func floatingView(floatingView: HHFloatingView, didTapHandler isOpening: Bool) { let configure = HHFloatingViewConfiguration() if isOpening == true { configure.handlerImage = #imageLiteral(resourceName: "closeFloting") configure.handlerColor = UIColor.white

   }
   else {

      configure.handlerImage = #imageLiteral(resourceName: "FloatingButton")
      configure.handlerColor = UIColor(red: 47/255.0, green: 89/255.0, blue: 246/255.0, alpha:
   }

}

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hemangshah/HHFloatingView/issues/8?email_source=notifications&email_token=AAZI6BBDOQ6SOBWSP63VRO3RE6DINA5CNFSM4K4XMRZKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IQXF6WA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZI6BHLN76KVSYEGLUBN2DRE6DINANCNFSM4K4XMRZA .

-- Sent from my iPhone

hemangshah avatar Feb 27 '20 09:02 hemangshah

@krutitrivedi for this, you can do like this

func floatingViewConfiguration(floatingView: HHFloatingView) -> HHFloatingViewConfiguration {
    ...
    configure.handlerImage = floatingView.isOpen ? #imageLiteral(resourceName: "icon-ufo") : #imageLiteral(resourceName: "icon-bird")
    configure.handlerColor = floatingView.isOpen ? UIColor.red.withAlphaComponent(0.5) : UIColor.blue.withAlphaComponent(0.5)
    ...
}

func floatingView(floatingView: HHFloatingView, didTapHandler isOpening: Bool) {
    floatingView.reload()
}

Let me know if that's helpful.

hemangshah avatar Feb 28 '20 12:02 hemangshah