yoavlt / LiquidFloatingActionButton

Material Design Floating Action Button in liquid state
MIT License
3.85k stars 468 forks source link

Customize Plus button #43

Open gabhisekdev opened 8 years ago

gabhisekdev commented 8 years ago

I am using this framework to create floating button in my project. I have a requirement to add a button image other than the plus sign in my project. Is it possible,I have tried many ways but failed. Please suggest some codes or ideas to do so? Thanks.

pedro380085 commented 8 years ago

Can't we change the plus button icon?

gabhisekdev commented 8 years ago

I don't think we can customize the plus button.

galileomd commented 8 years ago

you need to override the createpluslayer:

    class editLiquidButton: LiquidFloatingActionButton {
        override func createPlusLayer(frame: CGRect) -> CAShapeLayer {
            let editLayer = CAShapeLayer()
            // add shapelayer here
            return editLayer
        }
    }
gabhisekdev commented 8 years ago

But can we add image to it. If so then how?Can you please throw some light on that?

galileomd commented 8 years ago

let button = LiquidFloatingActionButton(frame: frame) button.image = UIImage(named: "yourfilehere")

gabhisekdev commented 8 years ago

Thanks,I will give it a try....