设置UIButton文字大小颜色不同
_loginBtn = [[UIButton alloc]initWithFrame:CGRectMake(iconX, CGRectGetMaxY(passwordBGView.frame)+25, 280, 35)];
[_loginBtn setTitle:@"进入游戏\nSTART GAME" forState:UIControlStateNormal];
_loginBtn.titleLabel.font = [UIFont systemFontOfSize:16]; NSMutableAttributedString *attString = [[NSMutableAttributedString alloc] initWithString:_loginBtn.titleLabel.text];
[attString addAttribute:(NSString*)NSForegroundColorAttributeName value:[UIColor whiteColor] range:[_loginBtn.titleLabel.text rangeOfString:_loginBtn.titleLabel.text]];
[attString addAttribute:(NSString*)NSForegroundColorAttributeName value:[UIColor whiteColor] range:[_loginBtn.titleLabel.text rangeOfString:@"START GAME"]];
[attString addAttribute:(NSString*)NSFontAttributeName value:[UIFont systemFontOfSize:10] range:[_loginBtn.titleLabel.text rangeOfString:@"START GAME"]];
[_loginBtn setAttributedTitle:attString forState:UIControlStateNormal]; _loginBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
_loginBtn.titleLabel.lineBreakMode = NSLineBreakByCharWrapping;

设置UIButton文字大小颜色不同的更多相关文章
- Python中如何设置输出文字的颜色
一.语法 1.实现过程 终端的字符颜色是用转义序列控制的,是文本模式下的系统显示功能,和具体的语言无关.控制字符颜色的转义序列是以ESC开头,即用\033来完成 2.书写过程 开头部分: \033 ...
- 代码设置UIButton文字、图片位置
假设有按钮rButton的 imageEdgeInsets和contentEdgeInsets可以设置按钮的标题和图片的位置,如下代码,设置标题居右 NSString * rBtnTitle = @& ...
- Eclipse中设置jsp文字大小
- UIAlertController 标题文字大小 颜色
NSString *title = [NSString stringWithFormat:]; NSString *msg = @"\n把红包分享给微信好友,金额随机,可用于购买雪票和雪卡& ...
- pulltorefresh 设置刷新文字提示颜色
xmlns:ptr="http://schemas.android.com/apk/res-auto" 赵泽民 2016/7/12 15:48:58 ptr:ptrHeaderS ...
- 用rem设置文字大小
一.px与em 用px设置文字大小是再正常不过的事情,比如 html {font-size: 12px;} 随处可见的在设置width.height使用px,这也是细致稳妥的设置方法,这样做的缺点在于 ...
- Android TextView设置多彩文字
在应用开发中时常会遇到需要在一段文字中插入几个不一样颜色文字的需求; 以前本人都是用多个TextView拼起来,不仅感觉很蠢,操作起来也蛮恶心; 直到接触到了SpannableStringBuilde ...
- iOS开发-- 设置UIButton的文字显示位置、字体的大小、字体的颜色
btn.frame = CGRectMake(x, y, width, height); [btn setTitle: @"search" forState: UIControlS ...
- 设置UIButton的文字显示位置、字体的大小、字体的颜色
btn.frame = CGRectMake(x, y, width, height); [btn setTitle: @"search" forState: UIControlS ...
随机推荐
- 使用dev http client调试restful API开发
安装chrome 插件:dev http client, 使用VPN打开 google网站,
- linux VFS 内核数据结构
<strong>简单归纳:fd只是一个整数,在open时产生.起到一个索引的作用,进程通过PCB中的文件描述符表找到该fd所指向的文件指针filp.</strong> 文件描述 ...
- postgresql pg_hba.conf
pg_hba.conf是客户端认证配置文件 METHOD指定如何处理客户端的认证.常用的有ident,md5,password,trust,reject. PostgreSQL默认只监听本地端口,用n ...
- HDU 4627 The Unsolvable Problem 2013 Multi-University Training Contest 3
给你一个数 n ( 2 <= n <= 109 ),现在需要你找到一对数a, b (a + b = n),并且使得LCM(a, b)尽可能的大,然后输出最大的 LCM(a, b). (为什 ...
- JSP的九个隐式(内置)对象
1.out 转译后对应JspWriter对象,其内部关联一个PrintWriter对象.是向客户端输出内容常用的对象. 2.request 转译后对应HttpServletRequest对象.客户端的 ...
- .net core 中的序列化和反序列化
学习博客:http://www.voidcn.com/blog/dujingjing1230/article/p-1204454.html
- [转]linux之date命令
转自:http://www.cnblogs.com/peida/archive/2012/12/13/2815687.html 在linux环境中,不管是编程还是其他维护,时间是必不可少的,也经常会用 ...
- 苹果将通过新Apple TV打造电视游戏平台 欲发力家庭游戏(转)
据<纽约时报>报道,9月10日凌晨1时举行的苹果发布会上将会公布新版Apple TV设备,还会推出TV版App Store.新设备以游戏作为主要卖点,图形性能将大幅提升. 苹果2015年秋 ...
- NSIS学习笔记(转)
转自:http://blog.csdn.net/lee353086/article/details/45919901 NSIS学习笔记Date:2015-05-20Author:kagulaEnv:V ...
- 【LeetCode】189 - Rotate Array
Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array ...