https://github.com/czl0325/zlimagetextbutton
支持autolayout的图上文下,图左文右,图下文上,图右文左的按钮。
https://github.com/czl0325/zlimagetextbutton
Last synced: 7 months ago
JSON representation
支持autolayout的图上文下,图左文右,图下文上,图右文左的按钮。
- Host: GitHub
- URL: https://github.com/czl0325/zlimagetextbutton
- Owner: czl0325
- License: apache-2.0
- Created: 2017-11-03T01:02:44.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-29T13:41:34.000Z (over 7 years ago)
- Last Synced: 2024-10-31T16:11:54.480Z (8 months ago)
- Language: Objective-C
- Homepage:
- Size: 188 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ZLImageTextButton
支持图左文右,图右文左,图上文下,图下文上4种模式的按钮,支持autolayout
### 12.12更新版本:
1.修复了不能及时刷新的BUG。
2.文字和图片增加了titleView和imageView的原生调用。### 11.22更新版本:
1.增加了cocoapods的支持。
2.增加了CGSize zlImageSize属性,可以自定义图片的大小,防止图片过大的情况,如果没有定制,有默认的图片大小。# 效果图

# 用法
```Objective-C
//导入ZLImageTextButton的类
#import "ZLImageTextButton.h"ZLImageTextButton* btn1 = [ZLImageTextButton buttonWithType:UIButtonTypeCustom];
btn1.zlButtonType = ZLImageTopTextBottom; //指定按钮的类型,未指定默认是图左问右
[btn1 setImage:[UIImage imageNamed:@"image1"] forState:UIControlStateNormal];
[btn1 setTitle:@"图上文下" forState:UIControlStateNormal];
[self.view addSubview:btn1];
[btn1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
make.top.mas_equalTo(50);
make.width.mas_equalTo(100);
make.height.mas_equalTo(70);
}];```