Giter Site home page Giter Site logo

joslynwu / csbutton Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 1.0 465 KB

一个UIButon的Category,可以调整图片与文字相对位置,图片和文字间距,指定文字宽度,以及图片显示大小。 Swift版本:https://github.com/JoslynWu/CSButton-Swift

License: MIT License

Objective-C 94.56% Ruby 5.44%

csbutton's Introduction

CSButton

License MIT

Custom the position of the ImageView relative to the titleLabel in UIButton.

一个UIButon的Category,可以调整图片与文字相对位置,图片和文字间距,指定文字宽度,以及图片显示大小。这是个OC版本。

Swift版入口:CSButton-Swift

特色

  • 使用便捷: 用分类实现,想用时添加属性即可。
  • 精致小巧: 只有2个文件

效果图

使用

1、 直接将Sources文件夹下文件添加(拖入)到项目中

UIButton+ImagePosition.h
UIButton+ImagePosition.m

2、 CocoaPods

pod 'CSButton'

功能

1、 调整图片与文字相对位置。

@property (nonatomic, assign) CSImagePositionMode cs_imagePositionMode;

该属性的枚举值:

typedef NS_ENUM(NSInteger, CSImagePositionMode) {
    ImagePositionModeDefault, 
    ImagePositionModeRight, 
    ImagePositionModeTop, 
    ImagePositionModeBottom
};

2、 调整图片与文字间的距离。

@property (nonatomic, assign) CGFloat cs_middleDistance;

3、 调整图片展示大小。

@property (nonatomic, assign) CGSize cs_imageViewSize;

4、 调整点击时图片高亮效果。默认关闭。

@property (nonatomic, assign) CGSize cs_imageViewSize;

csbutton's People

Contributors

joslynwu avatar

Stargazers

Lizhi0123 avatar  avatar 马文佳 avatar 小丶學習 avatar 何兵 avatar YougaKing avatar  avatar Carabineiro avatar

Watchers

James Cloos avatar Carabineiro avatar  avatar

Forkers

carabina

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.