Button添加红色的数字圆圈
2016-01-15 16:28
393 查看
如何给APP上面的Button添加红色的标示,类似如下的效果
其实很简单的,follow me~~~
1、添加一个类库:JSBadgeView
网上自己找了
2、随便定义一个button,然后添加之即可显示,代码如下喽
就像上面一样简单,然后你的功能就可以实现了,很简单吧,多用用就熟悉了。
其实很简单的,follow me~~~
1、添加一个类库:JSBadgeView
网上自己找了
2、随便定义一个button,然后添加之即可显示,代码如下喽
UIButton *btnMsg = [[UIButton alloc]initWithFrame:CGRectMake(CGRectGetMaxX(imageView.frame) + h1 * 0.4, h2 + 64 + h1 * 0.25, h1 * 0.25, h1 * 0.25)]; forState:UIControlStateNormal]; [btnMsg setImage:[UIImage imageNamed:@"xiaoxi"] forState:UIControlStateNormal]; [btnMsg setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; //this point==== js1 = [[JSBadgeView alloc]initWithParentView:btnMsg alignment:JSBadgeViewAlignmentTopRight]; [btnMsg addSubview:js1]; js1.badgeText = [NSString stringWithFormat:@"10"]; [self.view addSubview:btnMsg];
就像上面一样简单,然后你的功能就可以实现了,很简单吧,多用用就熟悉了。
相关文章推荐
- Linux基础入门学习笔记二
- Swift基础学习
- 《JavaScript启示录》学习笔记——第4章 Function()
- PHP----生成包含验证码的GIF图片
- intel 保修 由于受潮 CPU 主板 内存 硬盘 全部坏了
- MTU和MSS
- Android APP 引导页实现-第一次应用进入时加载
- js之放大镜
- 蓝桥杯入门训练 Fibonacci数列
- 续 codeforces 613B Skills
- JQuery经典例子:可拉伸菜单
- OpenGLES2.0着色器语言glsl
- 利用函数指针对数组进行排序
- C++ Primer 5th Chapter 8 学习笔记
- WebRequest设置Header应该放最前面
- 【SQL server】安装和配置
- C++运行时获取类型信息的type_info类与bad_typeid异常
- 【转】Linux服务器安全的25个小知识
- NSIS制作32+64位安装包
- ios 获取沙盒文件夹路径