Giter VIP home page Giter VIP logo

demo_buttonimagetitleedgeinsets's Introduction

Demo_ButtonImageTitleEdgeInsets

用button的titleEdgeInsets和 imageEdgeInsets属性来实现button文字图片上下或者左右排列的demo

image
这里有一篇总结

发现这个功能还挺常用的,每次都抄一遍也不方便,所以就封装为button的一个分类方法,只需一行代码就可以搞定~
[self.twoButton_line setImagePosition:LXMImagePositionTop spacing:10];

支持 CocoaPods

现在可以用CocoaPods按安装了 在你的podfile中添加
pod 'LXMButtonImagePosition', '~> 1.2.0'
然后在需要用的地方引入头文件
#import <UIButton+LXMImagePosition.h>

Update

1.2.0
优化性能问题。
发现在tableView或者collectionView快速滑动时,如果cell中使用了这个方法,会稍微有点耗时。时间是消耗在计算文字宽高的地方,而这个大部分是无用的重复计算,所以现在用NSCache来缓存计算过的文字宽高。
1.1.1
将支持的最低系统改为iOS5.0;之前写的7.1是没必要的,这些属性5.0之前就可以用了。
1.1.0
加入对contentInset的考虑,使button的intrinsicSize计算正确,更好的配合autoLayout

License

LXMButtonImagePosition is provided under the MIT license. See LICENSE file for details.

demo_buttonimagetitleedgeinsets's People

Contributors

phelthas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

demo_buttonimagetitleedgeinsets's Issues

兄弟,你这根本就pod不下来呀,赶紧修复下

[!] Unable to satisfy the following requirements:

  • LXMButtonImagePosition (= 1.1.0) required by Podfile

Specs satisfying the LXMButtonImagePosition (= 1.1.0) dependency were found, but they required a higher minimum deployment target.

我的版本是7.1~

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.