Flat design pressable button for iOS developers.

Related tags

Button ios objective-c
Overview

HTPressableButton

Build Status CocoaPods CocoaPods

HTPressableButton is designed for iOS developers to be able to spend time developing ideas, not building basic buttons. These stylish and flat-designed buttons can easily be modified and are perfect for almost any project. With no worry over color choice, HTPressableButton also includes beautiful color schemes that perfectly suit with your app.

Compatible with: iOS 6.0 and above

Current Version: 1.3.3

You can check out our documentation here. Installation

HTPressableButton can be installed via CocoaPods

pod 'HTPressableButton'

You may also quickly try the HTPressableButton example project with

pod try 'HTPressableButton'

However, if you are only interested to use the color scheme provided (shown below) then

pod 'HTPressableButton/HTColor'

Another option is to use git submodules or just download it and include it in your project manually.

NOTE: Please be reminded to add the header files to your project. You may add only the one that you'll use.

#import "HTPressableButton.h"
#import "UIColor+HTColor.h"

Button Types

IMPORTANT: You must specify the frame first. We'd like to know the size of your button first.

###Rectangular Button

    //Rectangular grape fruit color button
    CGRect frame = CGRectMake(30, 150, 260, 50);
    HTPressableButton *rectButton = [[HTPressableButton alloc] initWithFrame:frame buttonStyle:HTPressableButtonStyleRect];
    rectButton.buttonColor = [UIColor ht_grapeFruitColor];
    rectButton.shadowColor = [UIColor ht_grapeFruitDarkColor];
    [rectButton setTitle:@"Rect" forState:UIControlStateNormal];
    [self.view addSubview:rectButton];

HTPressableButton


###Rounded Rectangular Button

    // Rounded rectangular default color button
	frame = CGRectMake(30, 230, 260, 50);
    HTPressableButton *roundedRectButton = [[HTPressableButton alloc] initWithFrame:frame buttonStyle:HTPressableButtonStyleRounded];
    [roundedRectButton setTitle:@"Rounded" forState:UIControlStateNormal];
    [self.view addSubview:roundedRectButton];

HTPressableButton


###Circular Button

	//Circular mint color button
    frame = CGRectMake(110, 300, 100, 100);
    HTPressableButton *circularButton = [[HTPressableButton alloc] initWithFrame:frame buttonStyle:HTPressableButtonStyleCircular];
    circularButton.buttonColor = [UIColor ht_mintColor];
    circularButton.shadowColor = [UIColor ht_mintDarkColor];
    [circularButton setDisabledButtonColor:[UIColor ht_sunflowerColor]];
    [circularButton setTitle:@"Circular" forState:UIControlStateNormal];
    [self.view addSubview:circularButton];

HTPressableButton


###Disabled Button If you wish to create a disabled button, add:

	buttonNameHere.enabled = NO;

Example:

    //Disabled rounded rectangular button
    frame = CGRectMake(30, 420, 260, 50);
    HTPressableButton *disabledRoundedRectButton = [[HTPressableButton alloc] initWithFrame:frame buttonStyle:HTPressableButtonStyleRounded];
    disabledRoundedRectButton.disabledButtonColor = [UIColor ht_pinkRoseColor];
    disabledRoundedRectButton.disabledShadowColor = [UIColor ht_pinkRoseDarkColor];
    disabledRoundedRectButton.alpha = 0.5;
    disabledRoundedRectButton.enabled = NO;
    [disabledRoundedRectButton setTitle:@"DisabledButton" forState:UIControlStateNormal];
    [self.view addSubview:disabledRoundedRectButton];

HTPressableButton

The default alpha value is 1.0 for all type of buttons. The value can be changed (like the above disabled button) by:

	buttonNameHere.alpha = 0.5;

NOTE: We have set some default properties for you.

Property Values
Button Type HTPressableButtonStyleRounded
Corner Radius 10.0
Font Avenir
Font Size 18
Shadow Height 17% of the button's height
Button Color ht_jayColor
Button Shadow Color ht_jayDarkColor
Disabled Button Color ht_mediumColor
Disabled Button Shadow Color ht_mediumDarkColor

If you wish to set your own shadow height instead of using our default value, add:

	//Set shadow height of size 10
	buttonNameHere.shadowHeight = 10;

The different types of buttons have different default value set for its corner radius, you can modify it by:

    //Set corner radius to 20.0
    buttonNameHere.cornerRadius = 20;

To change the font of the button:

    //Set button font
    buttonNameHere.titleFont = [UIFont fontWithName:@"Avenir" size:18];

###Additional Colors You can freely use the additional colors in the file UIColors+HTColor anywhere in your project by:

    [UIColor ht_colorNameHere]
    
    //Examples
    [UIColor ht_jayColor]
    [UIColor ht_pinkRoseColor]

HTPressableButton



Contributors

Welcome contributors! Please don't hesitate to make an issue or pull request :)

####Maintainers He Rin Kim Thanakron Tandavas
####Contributors Paul Williamson Ben Manoj Mahapatra Pitiphong Phongpattranont Alexsander Akers Naji Dmeiri

Showcase

We would love to see how we became a part of your project. Send us an email, issue, tweet, or etc. and we'll update it here!

License

This project is licensed under the terms of the MIT license.

Credits

Inspired by:

Comments
  • Remove unnecessary methods and APIs.

    Remove unnecessary methods and APIs.

    We can provide the default values of button properties in the init method. We remove button property setter methods which are redundant with the button’s properties. And one last thing, I also revised the button creating algorithm.

    opened by pitiphong-p 16
  • CocoaDocs landing page is not working

    CocoaDocs landing page is not working

    CocoaDocs landing page of the new version 1.0.3 disappeared; However, the landing page of version 1.0.2 is still working.

    Need to find a better solution to get the landing page working whenever we release a new version.

    opened by tandavas 13
  • Implement storyboard (or xib) use

    Implement storyboard (or xib) use

    It would be useful to be able to set the buttons directly in storyboards, just by changing the class of the normal unbutton object. Any plan on implementing it?

    question 
    opened by klauslanza 11
  • Add basic tests. Fixes #30.

    Add basic tests. Fixes #30.

    I've added a small suite of basic view tests, using FBSnapshotTestCase. We should now be confident that any changes made will not affect existing installs. screen shot 2014-05-18 at 01 18 33

    :beers: :+1:

    opened by squarefrog 10
  • Cleaned up some of the code relating to default colors

    Cleaned up some of the code relating to default colors

    NOTE: please don't feel like you have to merge this. It's unfinished, I'm just sending you this PR so you can see one way of tackling some of the code cleanup.

    I have removed all the setDefaultXX color methods, and replaced them with a simple ternary operator. Have a look and see what you think. If you think you like it I'll finish it up.

    But again, don't merge this this is just an option for you!

    opened by squarefrog 10
  • Checking CGFloat will always return true.

    Checking CGFloat will always return true.

    You are checking if shadowHeightSet here.

    However, as CGFloat is a primitive, this will always return true. For example, if no value is set to shadowHeight it's default value will be 0.0.

    You can only do nil checks on objects - NSString, NSNumber etc.

    opened by squarefrog 9
  • Typo in method name

    Typo in method name

    You have a typo on this line

    + (UIImage *) ht_buttonWithHighlightedColor: (UIColor *) buttonColor
                                           size: (CGSize) size
                                   shadowHeight: (CGFloat) shadowHeight
                                    chadowColor: (UIColor *) shadowColor
                                   cornerRadius: (CGFloat) cornerRadius;
    

    Should be

    + (UIImage *) ht_buttonWithHighlightedColor: (UIColor *) buttonColor
                                           size: (CGSize) size
                                   shadowHeight: (CGFloat) shadowHeight
                                    shadowColor: (UIColor *) shadowColor
                                   cornerRadius: (CGFloat) cornerRadius;
    
    opened by squarefrog 6
  • Initiation extremely slow

    Initiation extremely slow

    Creating 4 buttons:

    NSArray *buttons = @[_quizButton1, _quizButton2, _quizButton3, _quizButton4];
        for (HTPressableButton *button in buttons){
            CGRect frame = CGRectMake(30, 150, 260, 50);
            HTPressableButton *rectButton = [[HTPressableButton alloc] initWithFrame:frame buttonStyle:HTPressableButtonStyleRect];
            rectButton.buttonColor = [UIColor ht_grapeFruitColor];
            rectButton.shadowColor = [UIColor ht_grapeFruitDarkColor];
            [rectButton setTitle:@"Rect" forState:UIControlStateNormal];
            [self.view addSubview:rectButton];
        }
    

    I logged the times. They add up to almost half a second for initiating 4 buttons. This is way too slow. Am I doing something wrong?

    2015-02-23 16:38:11.784 [8769:2165117] executionTime = 0.075211
    2015-02-23 16:38:11.876 [8769:2165117] executionTime = 0.085640
    2015-02-23 16:38:11.973 [8769:2165117] executionTime = 0.091672
    2015-02-23 16:38:12.080 [8769:2165117] executionTime = 0.102649
    
    opened by xiaoxu193 5
  • Circular buttons disabled state frame

    Circular buttons disabled state frame

    When I disable a circular button, it's frame is increased by about 5px in two directions. When it is re-enabled, it goes back to its normal size. Is this expected?

    opened by lukenewman 4
  • buttonShadowColor is not used in -[createButton]

    buttonShadowColor is not used in -[createButton]

    You are setting a BOOL here, and using it here but then you don't actually set the disabled image in this method.

    You actually set it in -[setEnabled:], which is correct. So those lines can probably go.

    opened by squarefrog 4
  • bool is uncommon in Objective-C, use BOOL instead

    bool is uncommon in Objective-C, use BOOL instead

    While bool is valid, it's definitely uncommon. It is much more common to use BOOL instead. Take a look at this Stack Overflow answer, and this NSHipster article for more information.

    opened by squarefrog 4
  • Cannot get to implement any action on the HTPressableButton press

    Cannot get to implement any action on the HTPressableButton press

    Hi, I am trying to implement an action on click on HTPressableButton, I have tried to connect the button with an action method but it does not seem to be working. Any Ideas on were I could be wrong please?

    opened by srikanthraj 1
Releases(1.3.3)
Owner
Famolus
We build websites with code and pixels.
Famolus
Flat button with 9 different states using POP

VBFPopFlatButton Flat button with 21 different states and 2 types animated using pop. These are some examples of both types in different states: And h

Victor Baro 3.1k Nov 30, 2022
Yet another animated flat buttons in Swift

DynamicButton is a powerful flat design button written in Swift to display hamburger button like with animated transitions between style updates. It a

Yannick Loriot 1.2k Jan 5, 2023
Customizable download button with progress and transition animations. It is based on Apple's App Store download button.

AHDownloadButton is a customizable download button similar to the download button in the latest version of Apple's App Store app (since iOS 11). It fe

Amer Hukić 465 Dec 24, 2022
Revamped Download Button. It's kinda a reverse engineering of Netflix's app download button.

NFDownloadButton Revamped Download Button Requirements Installation Usage License Requirements iOS 8.0+ Swift 4.2+ Xcode 10.0+ Installation CocoaPods

Leonardo Cardoso 433 Nov 15, 2022
Material Design Floating Action Button in liquid state

LiquidFloatingActionButton [] (https://github.com/Carthage/Carthage) LiquidFloatingActionButton is floating action button component of material design

Takuma Yoshida 3.8k Dec 29, 2022
Jorge Ovalle 305 Oct 11, 2022
Floaty is simple floating action button for iOS.

Floaty is simple floating action button for iOS. (formerly KCFloatingActionButton) Why change the name? Follow the swift naming convention. KCF

Lee Sun-Hyoup 1.5k Jan 7, 2023
iOS Pod for a Soft UI (Neumorphic) Button for UIKit written in Swift

iOS Pod for a Soft UI (Neumorphic) Button for UIKit written in Swift

Pallav Agarwal 21 Oct 23, 2022
iOS 7-style bouncy button.

SSBouncyButton SSBouncyButton is simple button UI component with iOS 7-style bouncy animation. Take A Look Try It! pod 'SSBouncyButton', '~> 1.0' Use

StyleShare 310 Dec 15, 2022
A high-performance button control with rounded corners for iOS.

TORoundedButton TORoundedButton is an open source UI control of a standard user button. Its design consists of displaying text on top of a solid recta

Tim Oliver 480 Dec 26, 2022
Cute Animated Button written in Swift.

DOFavoriteButton Cute Animated Button written in Swift. It could be just right for favorite buttons! Requirements iOS 7.0+ Swift 1.2 Installation Cart

Daiki Okumura 3.6k Dec 29, 2022
Customizable and easy to use expandable button in Swift.

ExpandableButton Requirements iOS 9.0+ Installation CocoaPods: Add the following line to your Podfile: pod 'ExpandableButton' #for swift less than 4.

Dmytro Mishchenko 98 Dec 5, 2022
Easily customizable floating button menu created with SwiftUI

FloatingButton Easily customizable floating button menu created with SwiftUI We are a development agency building phenomenal apps. Usage Create main b

Exyte 715 Dec 30, 2022
IGStoryButtonKit provides an easy-to-use button with rich animation and multiple way inspired by instagram story/stories.

Introduction Have you ever seen UI like instagram story, haven't you? Actually, features like instagram story have been implemented in many applicatio

mutation 34 Nov 8, 2022
LTHRadioButton - A radio button with a pretty animation

LTHRadioButton Slightly inspired by Google's material radio button. The clip below has 3 sections: full speed, 25% and 10%, but after converting it to

Roland Leth 368 Dec 16, 2022
Multiple state tap-to-toggle UIButton (like old camera flash button)

Multiple State Toggle UIButton A UIButton subclass that implements tap-to-toggle button text. (Like the camera flash and timer buttons) Usage Just cre

Yonat Sharon 83 Oct 11, 2022
Lickable-Button We made the buttons on the screen look so good you'll want to lick them

Lickable-Button We made the buttons on the screen look so good you'll want to lick them. - Steve Jobs A little SwiftUI button project at WWDC 2021 Lic

Nate Thompson 14 Dec 29, 2021
Craft that perfect SwiftUI button effect 👌🏼

buttoncraft (SwiftUI 3.0 App) Experimenting with SwiftUI 3.0 whilst creating a practical app to craft that perfect button style. ✈️ Testflight https:/

An Trinh 188 Dec 28, 2022
Custom loading button with progress swiftui

CustomLoadingButton Simple Custom Loading Progress Button for SwiftUI Version 1.0.0 This version requires Xcode 11+ SwiftUI iOS 13+ macOS 10.15+ Insta

Tariqul 1 Dec 14, 2022