• 设置UIButton文字大小颜色不同


    _loginBtn = [[UIButton alloc]initWithFrame:CGRectMake(iconX, CGRectGetMaxY(passwordBGView.frame)+25, 280, 35)];
    [_loginBtn setTitle:@"进入游戏
    START 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;
    

     

  • 相关阅读:
    struts1.X的jar包
    struts2.1.6所需jar包详解
    hibernate的运行原理
    hibernate的save()方法详解
    flash的动态加载技术
    havok之内存管理
    worker中加载本地文件报错的解决方案
    行为树之我见
    havok之thread和memory system
    havok之collision detection
  • 原文地址:https://www.cnblogs.com/damiao/p/4394563.html
Copyright © 2020-2023  润新知