GithubHelp home page GithubHelp logo

lihuiyao1986 / imagecenterbutton Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alithink/imagecenterbutton

0.0 2.0 0.0 179 KB

An UIButton with TopImage and BottomLabel

License: MIT License

Ruby 3.69% Objective-C 96.31%

imagecenterbutton's Introduction

ImageCenterButton

An UIButton with TopImage and BottomLabel

What

ImageCenterButton is a subclass of UIButton. Use it you can make a button with imageview upon the button textlabel easily.

Features

  • Dynamic image frame generated
  • Spacing between imageview and textlabel customization
  • Image padding customization
  • Round image support
  • Dynamic button backgroundColor customization
  • IB_DESIGNABLE and IBInspectable added(Andrey Yastrebov ^_^)

CocoaPods

To use ImageCenterButton add the following to your Podfile

pod 'ImageCenterButton'

Usage

// Round Image
@property(nonatomic) IBInspectable BOOL imageIsRound;
// Image Padding
@property(nonatomic) IBInspectable CGFloat padding;
// Spacing between imageview and textlabel
@property(nonatomic) IBInspectable CGFloat imageTextSpace;
// Maximum imageview size
@property(nonatomic) IBInspectable CGSize imageViewMaxSize;
// Button backgroundHighlighted
@property(nonatomic, strong) IBInspectable UIColor *backgroundHighlightedColor;
// Button backgroundNormal
@property(nonatomic, strong) IBInspectable UIColor *backgroundNormalColor;
// Border width
@property(nonatomic) IBInspectable CGFloat borderWidth;
// Border Color
@property(nonatomic, strong) IBInspectable UIColor *borderColor;

License

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


README(Chinese)

ImageCenterButton 是什么

ImageCenterButton 是UIButton的子类。可以用它很方便的生成图像在上文字标签在下的按钮。

ImageCenterButton提供了哪些功能

  • 根据按钮大小动态调整图像大小
  • 图像与文字标签间距可定制
  • 图像padding可定制
  • 支持生成圆形图像
  • 按钮不同状态背景色可定制
  • 添加IB_DESIGNABLE IBInspectable 支持(感谢Andrey Yastrebov的支持)

ImageCenterButton 使用配置

// 是否将图像设置成圆形
@property(nonatomic) IBInspectable BOOL imageIsRound;
// 图像padding设置
@property(nonatomic) IBInspectable CGFloat padding;
// imageview和textlabel间距设置
@property(nonatomic) IBInspectable CGFloat imageTextSpace;
// imageview最大尺寸设置
@property(nonatomic) IBInspectable CGSize imageViewMaxSize;
// Button高亮状态背景色设置
@property(nonatomic, strong) IBInspectable UIColor *backgroundHighlightedColor;
// Button普通状态背景色设置
@property(nonatomic, strong) IBInspectable UIColor *backgroundNormalColor;
// 边框宽度设置
@property(nonatomic) IBInspectable CGFloat borderWidth;
// 边框颜色设置
@property(nonatomic, strong) IBInspectable UIColor *borderColor;

CocoaPods 支持

你可以在 Podfile 中加入下面一行代码来使用ImageCenterButton

pod 'ImageCenterButton'

协议

ImageCenterButton 被许可在 MIT 协议下使用。查阅 LICENSE 文件来获得更多信息。

imagecenterbutton's People

Contributors

alithink avatar ayastrebov avatar

Watchers

James Cloos avatar 李焱生 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.