Skip to content

lilei644/LLBootstrapButton

Repository files navigation

LLBootstrapButton

Bootstrap 3.0扁平化风格按钮,一句代码调用
  以前开发过web端的同学可能用过Twitter公司出的一个前端框架Bootstrap,当时刚接触的时候是2.0的版本,后来是3.0,从立体化的风格到现在扁平化的风格,一直以一种简约大方的设计风格体现,深受开发者的喜爱

  对于我们这种没有美工妹纸当女票的人来说移动开发就是悲剧,所以后来发现Android开发中也有Bootstrap和BootstrapButton两个框架,显示风格和网页扁平简约的风格一样。于是最近将BootstrapButton部分移植了一个OC版本,以便喜欢这种风格的同学方便使用,维持了原本web端自带的图标字体(fontawesome),可一键调用!!!

  先上效果图,共6种风格,每种分正常,高亮,也可添加图标

image

使用方法

  • CocoaPods(若未获取成功需重新 pod setup )
pod "LLBootstrapButton"

  CocoaPods导入后则无需手动导入Bundle,可直接使用

  • 导入
#import "LLBootstrap.h"

添加背景效果

[button bs_configureAsDefaultStyle]

  分为6中风格,默认是可点击

[button bs_configureAsDefaultStyle]              // 默认
[button bs_configureAsPrimaryStyle]              // 原色
[button bs_configureAsSuccessStyle]              // 成功
[button bs_configureAsInfoStyle]                 // 消息
[button bs_configureAsWarningStyle]              // 警告
[button bs_configureAsDangerStyle]               // 危险



添加图标

  • 导入Bundle到项目中(若使用CocoaPods集成则无需此操作)
    image
  • 调用方法(根据图标代码选择图标)
// 使用图标签需要先设置字体
UIFont *font = [UIFont bs_awesomeFontOfSize:16.f];

``` [button.titleLabel setFont:[UIFont bs_awesomeFontOfSize:16.f]]; // 选择苹果图标,置前 [button setTitle:[NSString stringWithFormat:@"%@ Primary", @"fa-apple".bs_awesomeIconRepresentation] forState:UIControlStateNormal]; ```
``` // UITextView直接显示图标 [textview setText:[NSString stringWithFormat:@"这是一个%@图标",@"fa-github-alt".bs_awesomeIconRepresentation]]; ``` * 支持图标可达300多种,符合大部分需求
![image](https://github.com/lilei644/LLBootstrapButton/blob/master/Img/fontIcon.png)   图标代码打开资源文件中的htm文件即可显示所有图标
`使用注意:由于图标为文字生成,所以必须设置字体`

致谢

About

Bootstrap 3.0扁平化风格按钮,自带图标,一句代码直接调用!!!

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published