• Stars
    star
    230
  • Rank 174,053 (Top 4 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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.

More Repositories

1

LXMLyricsLabel

A label that can change its textColor gradually like lyrics
Objective-C
38
star
2

LXMThirdLoginManager

LXMThirdLoginManager
Objective-C
36
star
3

LXMRevealDemo

A UIView category for reveal animation
Objective-C
33
star
4

LXMWaterfallLayout

A collectionViewLayout layout cells like waterfall, which add the missing collectionViewHeader and collectionViewFooter
Swift
28
star
5

TEST_XMLCommon

用来总结整理自己写过的代码,方便以后复用
Objective-C
25
star
6

LXMExpandLayout

A UICollectionViewLayout that can expand one item with spring animation without doing any transition, support cell with any size
Objective-C
25
star
7

LXMRulerView

A ruler View could be used as a value picker or a value displayer
Objective-C
22
star
8

Demo_AlarmClock

A alarm clock demo written in Swift 3.0, similar to the Apple clock App
Swift
17
star
9

LXMPieView

A simple pie view that could be shown with a clock Animation, and could recognize which section is tapped
Objective-C
10
star
10

LXMDownloader

一个封装好的文件下载库,可以用来下载视频或其他文件,支持后台下载,断点续传。
Swift
5
star
11

Demo_Calendar

A custom calendar, using NSCalendar and UICollectionView to implement
Objective-C
4
star
12

XMLTagView

a tagView for displaying tags, tag with multiple lines supported, using PureLayout
Objective-C
3
star
13

LXMCollectionIndexView

Adding "Index" for UICollectionView, it looks just like the UITableView index
Swift
3
star
14

LXMPauseTimer

A category that could pause and continue a NSTimer with accurate time interval
Objective-C
2
star
15

LXMBlockKit

Some category adding block API for UIKit
Objective-C
2
star
16

Demo_FileManagerWithFMDB

A demo shows how to manger a (M to N table) with FBMD
Objective-C
2
star
17

LXMKeyboardManager

一个通过监听键盘然后调整textField位置使之不会被键盘挡住的工具类
Objective-C
2
star
18

LXMSnippets

some snippets to simplify coding
1
star
19

ARTS

punch time card
1
star
20

LXMXcodeTemplate

Some Custom Xcode Tempates to make it easier to start a project
1
star
21

LXMPlayer

简单封装AVPlayer的播放器,方便结构化代码
Objective-C
1
star
22

LearnOpenGL

learnOpenGL blog and demo
C++
1
star