Giter Club home page Giter Club logo

jtimagebutton's Introduction

JTImageButton

With the regular UIButton you are able to set title and also image for that button but that content WILL NOT be centered horizontally (only title will).

JTImageButton is a UIButton subclass that makes title+image work easier. Your image and title together WILL BE centered horizontally. You will be also able to resize provided image and change it’s color easier, so basically all you have to provide is a text as a title and image (NO MORE image asset editing to get an image that you want in a button).

“Example”/

Installation

There are two ways to add the JTImageButton library to your project. Add it as a regular library or install it through CocoaPods.

pod 'JTImageButton'

Library require iOS 7.0 and above target

Usage and Customization

Create UIButton in your .xib/storyboard with IBOutlet and set class to JTImageButton (Also button type should be Custom) OR initWithFrame if you need it programatically.

Use -(void)createTitle:withIcon:font:iconHeight:iconOffsetY:

Or to keep original image size use -(void)createTitle:withIcon:font:iconOffsetY:

Standard example:

[self.btn createTitle:@“DONE” 
          withIcon:[UIImage imageNamed:@"icon_tick"] 
          font:nil 
          iconHeight:JTImageButtonIconHeightDefault 
          iconOffsetY:JTImageButtonIconOffsetYNone];

Another properties

@property (nonatomic, strong) UIColor *titleColor;
@property (nonatomic, assign) UIColor *iconColor;
@property (nonatomic, strong) UIColor *bgColor;

// Small/Medium/Big/None
@property (nonatomic, assign) JTImageButtonPadding padding;
@property (nonatomic, assign) CGFloat cornerRadius;
@property (nonatomic, strong) UIColor *borderColor;
@property (nonatomic, assign) CGFloat borderWidth;

// Left/Right
@property (nonatomic, assign) JTImageButtonIconSide iconSide;
@property (nonatomic, assign) CGFloat highlightAlpha;

Changelog

v1.0.0 - 05.13.15

  • [NEW] Initial commit

Author

This library is open-sourced by Jakub Truhlar.

License

The MIT License (MIT) Copyright © 2015 Jakub Truhlar

jtimagebutton's People

Contributors

kubatruhlar avatar

Watchers

woshizilong 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.