GithubHelp home page GithubHelp logo

lizhaojie001 / btsimpleripplebutton Goto Github PK

View Code? Open in Web Editor NEW

This project forked from balram3429/btsimpleripplebutton

0.0 2.0 0.0 1.43 MB

This is a custom button with Ripple effect

License: MIT License

Objective-C 100.00%

btsimpleripplebutton's Introduction

BTSimpleRippleButton

This is a custom button for iOS with Ripple effect. It is simple to integrate & customizable component. Suppors callback using blocks.

btSimpleRippleButton Screenshot . btSimpleRippleButton Screenshot . btSimpleRippleButton Screenshot

Requirements

  • Xcode 5 or higher
  • Apple LLVM compiler
  • iOS 7.1 or higher
  • ARC

Demo

Build and run the BTSimpleRippleButton project in Xcode to see BTRippleButtton in action.

Installation

  1. Drag the file btRippleButtton.h / btRippleButtton.m to your project. Alternatively you can add the folder btRippleButton to your project.
  2. Maken an import statement for the file as #import"BTRippleButtton.h" .
  3. Add to your project the QuartzCore framework make an import statement for it.

Initialization

Simple Initialization

To go with a simple initialization, use the below method. Provide an image, frame size, the target method & the sender view.

BTRippleButtton *rippleButton = [[BTRippleButtton alloc]initWithImage:[UIImage imageNamed:@"pin.png"]
                                                             andFrame:CGRectMake(144, 55, 32, 32)
                                                            andTarget:@selector(buttonTapped:)
                                                                andID:self];
                                                                
[rippleButton setRippeEffectEnabled:YES];
[rippleButton setRippleEffectWithColor:[UIColor colorWithRed:240/255.f green:159/255.f blue:10/255.f alpha:1]];
[self.view addSubview:rippleButton];

Block based call back

For block based initialization to enable call back, use the below simple method.

BTRippleButtton *rippleButtonGreen = [[BTRippleButtton alloc] initWithImage:[UIImage imageNamed:@"author.png"]
                                                                   andFrame:CGRectMake(110, 300, 99, 99)
                                                               onCompletion:^(BOOL success) {
                                                                   
                                                                   // add here more code to block
                                                                   NSLog(@"I am from Block, execution.");
                                                                       
                                                                   }];
    
[rippleButtonGreen setRippeEffectEnabled:YES];
[rippleButtonGreen setRippleEffectWithColor:[UIColor colorWithRed:204/255.f green:270/255.f blue:12/255.f alpha:1]];
[self.view addSubview:rippleButtonGreen];

Contact

License

btSimpleRippleButton is available under the MIT license.

Copyright © 2014 Balram Tiwari.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

btsimpleripplebutton's People

Contributors

balram3429 avatar 100mango avatar

Watchers

James Cloos avatar BenchZJ avatar

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.