zoukankan      html  css  js  c++  java
  • iOS 用keypath设置一些属性

    1.UIButton title 距左边显

    button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    

      

      

    2.UITextField placeholder 颜色

    方法一:

    textField.placeholder = @"this is placeholder";  
    [textFieldsetValue:[UIColor redColor]forKeyPath:@"_placeholderLabel.textColor"];  
    [textFieldsetValue:[UIFontboldSystemFontOfSize:16]forKeyPath:@"_placeholderLabel.font"]; 
    

      

    方法二:(iOS 6 之后)

    NSMutableAttributedString *placeholder = [[NSMutableAttributedString alloc]initWithString:@"this is placeholder"];
    
    [placeholderaddAttribute:NSForegroundColorAttributeName
                      value:[UIColor redColor]
                      range:NSMakeRange(0, placeholder.length)];
    
    [placeholderaddAttribute:NSFontAttributeName
                      value:[UIFontboldSystemFontOfSize:14]
                      range:NSMakeRange(0, placeholder.length)];
    
    
    textField.attributedPlaceholder = placeholder;
    

    3.隐藏 tabBar 顶部的分割线

    [self.tabBar setValue:@(YES) forKeyPath:@"_hidesShadow"];
    

      

      

  • 相关阅读:
    华为鲲鹏服务器测试
    gcc反汇编测试
    信息安全系统设计与实现:第五章学习笔记
    C语言实现ls之myls改进
    C语言编程实现mystat
    基于openEuler的OpenSSL编译安装和编程实践
    团队作业(三):确定分工
    centos的网络配置及克隆操作要点
    Flink特点分析
    机器学习之线性回归模型
  • 原文地址:https://www.cnblogs.com/saytome/p/6964779.html
Copyright © 2011-2022 走看看