zoukankan      html  css  js  c++  java
  • 给label text 上色 && 给textfiled placeholder 上色

    1、给label text 上色:

    NSInteger stringLength = 0;   
            stringLength = model.ToUserNickName.length;
            NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:string];
            NSLog(@"textLength is %u", model.ToUserNickName.length);
            [str addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(2,stringLength)];
            self.CommentContent.attributedText = str;     // self.CommentContent.attributedText  是一个 label

    2、

    textField.placeholder = @"username is in here!";  
    [textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];  
    [textField setValue:[UIFont boldSystemFontOfSize:16] forKeyPath:@"_placeholderLabel.font"]; 
    
    
    // 转自 http://blog.csdn.net/woaifen3344/article/details/38352015 
  • 相关阅读:
    云计算-MapReduce
    云计算--hbase shell
    云计算--hdfs dfs 命令
    云计算--MPI
    jQuery 效果
    jQuery 效果
    JQuery效果隐藏/显示
    JQuery教程
    六级啊啊啊
    jQuery 安装
  • 原文地址:https://www.cnblogs.com/cnrong/p/5001490.html
Copyright © 2011-2022 走看看