GithubHelp home page GithubHelp logo

zoonooz / zfripplebutton Goto Github PK

View Code? Open in Web Editor NEW
1.4K 33.0 110.0 524 KB

Custom UIButton effect inspired by Google Material Design

License: MIT License

Swift 67.65% Ruby 32.35%
ios-swift custom-uibutton uibutton google-material

zfripplebutton's Introduction

ZFRippleButton

iOS Custom UIButton effect inspired by Google Material Design written in Swift

Usage

Set the UIButton class in Nib to ZFRippleButton or create it programmatically.

Options

rippleOverBounds indicate that ripple should draw outsise the bounds or not

trackTouchLocation indicate that ripple should show from the touch location or not

shadowRippleEnable indicate that it will show additional shadow when you click or not

touchUpAnimationTime is time interval of touch up animation

and you can set the color of ripple using rippleColor and rippleBackgroundColor

Requirements

  • iOS >= 8.0

Author

Amornchai Kanokpullwad, [email protected]

License

ZFRippleButton is available under the MIT license. See the LICENSE file for more info.

zfripplebutton's People

Contributors

5d avatar coffee-cup avatar italika-git avatar michaeldanieltom avatar ronaldmak avatar zoonooz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zfripplebutton's Issues

UIViewReportBrokenSuperviewChain iOS 10 crash

I'm getting the following error on iOS 10. This is a new error so not seen a lot on Stackoverflow about this:
http://stackoverflow.com/questions/39565424/swift-uiviewreportbrokensuperviewchain-cause-by-layer-manipulation

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'View has lost track of its superview, most likely through unsupported use of CALayer API on the view's layer. If this isn't a crash yet, it will be in the near future. Problem view: <UIView: 0x7e70e630; frame = (0 0; 72 205); alpha = 0; layer = <CALayer: 0x7a6521b0>> Expected parent: <ZFRippleButton.ZFRippleButton: 0x7a906fb0; baseClass = UIButton; frame = (528 12; 72 205); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x7e7144e0>> Break on UIViewReportBrokenSuperviewChain to debug.'

Image disappeared on click

I really like this library. Now i am facing issue which when i tapped on button then image that i set has been disappeared but when my finger has released then image appears as usual.
Can you solve this problem?

button.rippleColor = UIColor.red
button.backgroundColor = UIColor.red
button.setTitle("File Server", for: .normal)
button.setImage(UIImage(named: "filesharing"), for: .normal)
button.titleLabel?.font = UIFont(name: "SFCompactText-Regular", size: 16)
button.titleEdgeInsets = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 0)

UIViewReportBrokenSuperviewChain on iOS 10

I'm addressing a UIViewReportBrokenSuperviewChain issue which makes my app to crash.
My buttons are added on the view using Interface Builder, no code.
They were working fine on Xcode 7 / iOS 9. No changes are made with Xcode 8 / iOS 10, I just opened the project, run it on a real device and get this crash.

I'm using ZFRippleButton 0.5.1.

2016-10-21 10:02:48.620067 Cinemappy[9732:2494425] *** Assertion failure in void UIViewReportBrokenSuperviewChain(UIView *__strong, UIView *__strong, BOOL)(), /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3599.6.1/UIView.m:190
2016-10-21 10:03:05.951306 Cinemappy[9732:2494425] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'View has lost track of its superview, most likely through unsupported use of CALayer API on the view's layer. If this isn't a crash yet, it will be in the near future. 
    Problem view: <UIView: 0x15fc91740; frame = (0 0; 1000 1000); alpha = 0; layer = <CALayer: 0x1746298c0>>
    Expected parent: <ZFRippleButton.ZFRippleButton: 0x15fc90b40; baseClass = UIButton; frame = (0 0; 1000 1000); opaque = NO; autoresize = RM+BM; tintColor = UIExtendedSRGBColorSpace 1 1 1 1; layer = <CALayer: 0x174821f20>>
Break on UIViewReportBrokenSuperviewChain to debug.'
*** First throw call stack:
(0x1894dc1c0 0x187f1455c 0x1894dc094 0x189f66898 0x18f604f9c 0x18f605658 0x18fc7b390 0x189f122bc 0x189f07ab8 0x189f0765c 0x189f07444 0x18f42a76c 0x18f42a4d0 0x18f371be0 0x19553fd04 0x19553fad4 0x195553d5c 0x18f6195e8 0x18f33beac 0x1893c91a4 0x1893c90a0 0x18f32ac30 0x18f427330 0x18f61f2c4 0x18f32254c 0x18c7ea40c 0x18c7df0e8 0x18c7defa8 0x18c75bc64 0x18c
libc++abi.dylib: terminating with uncaught exception of type NSException

Failed to render and updater auto layout status

Hi there,

I've gotten two errors below after updating to Xcode 8.2.1:

Main.storyboard: error: IB Designables: Failed to render and update auto layout status for ViewController (BYZ-38-t0r): dlopen(ZFRippleButton.framework, 1): no suitable image found. Did find:
ZFRippleButton.framework: required code signature missing for 'ZFRippleButton.framework'

Main.storyboard: error: IB Designables: Failed to update auto layout status: dlopen(ZFRippleButton.framework, 1): no suitable image found. Did find:
ZFRippleButton.framework: required code signature missing for 'ZFRippleButton.framework'

Not sure but maybe it's not related to new update of Xcode.

Thank you,
Serhiy

Ripple doesn't update if frame changes

I usually set my frames to CGRectZero on initialize and update the frame later based on the size of the text in the button.

If I work that way, the ripple doesn't show.

Swift Compile Error

I hit so many swift compile error when I build my project, attached screenshots for this issue.

screen shot 2014-10-12 at 3 16 32 am

issue with image

when setting an image the rippleBackgroundColor is drawn above the image and the rippleColor above the rippleBackgroundColor
I had to set rippleBackgroundColor to clear (remains the backgroundcolor) and the rippleColor with an alpha component < 1

        buttonSelect.backgroundColor = UIColor.redColor
        buttonSelect.rippleBackgroundColor = UIColor.clearColor() //or color with low alpha
        buttonSelect.rippleColor = redColor().lightenColor().colorWithAlphaComponent(0.5)


        buttonSelect.tintColor = white
        buttonSelect.setImage(UIImage(named: "image")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), forState: UIControlState.Normal)

//        buttonSelect.setImage(UIImage(named: "image")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), forState: UIControlState.Highlighted)
//        buttonSelect.setImage(UIImage(named: "image")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), forState: UIControlState.Selected)

        buttonSelect.imageView?.contentMode = UIViewContentMode.ScaleAspectFit

states Highlighted and Selected do not give visible influences

Can't set rippleColor and rippleBackgroundColor Programmatically

Dear team,

When we upgrade the library to support Swift3, when we do such as : rippleButton.rippleColor = UIColor.green, produce error : Failed to set (rippleColor) user defined inspected property on (UIButton): [<UIButton 0x113d20f00> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key rippleColor.

While for the Swift 2 version, we can set it programmatically.

Best Regards,

make setup public

The setup method is a nice function to override for subclasses that extend the button. I'd like to suggest it be made public.

Xcode 7.1 errors (not public methods)

Hello!

Thank you for fix previews issue. But the code still have errors. You have some methods as private, this methods should be public.

http://joxi.ru/8ZrJodMieDlvmj

            cell.controlButton.rippleBackgroundColor = .grayColor()
            cell.controlButton.rippleColor = .lightGrayColor()
            cell.controlButton.ripplePercent = 1

Can you fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.