zoukankan      html  css  js  c++  java
  • UISwitch

     1 1. onTintColor 
     2   处于on时switch 的颜色
    switchImage.onTintColor = [UIColor grayColor];
     3 2.tintColor 
     4 处于off时switch 的颜色
     5     switchImage.tintColor = [UIColor greenColor];
     6 3.onImage    
     7   设置on 的图标
    switchImage.onImage = [UIImage imageNamed:@"1.png"];
     8 
     9 4. offImage
    10    设置off的图标
 switchImage.offImage = [UIImage imageNamed:@"4.png"];
    11 
    12 5. on
    13 设置switch的开关
    14 swithImage.on = YES;
    15 
    16 6.thumbTintColor
    17 设置拇指颜色
    18 swithImage.thumbTintColor = [UIColor redColor];
    19 效果:
    20 
    21 
    22 
    23 7.增加事件响应机制
    24 监听的是这个事件:UIControlEventValueChanged,值改变事件
    25 [switchImage addTarget:self action:@selector(switchOn) forControlEvents:UIControlEventValueChanged];
  • 相关阅读:
    Maven ==> 简介
    IDEA结合GIT的使用
    Shell ==> 基础
    Dubbo ==> 简介
    iptables防火墙
    文件系统对比
    supervisord部署
    inotify+rsync安装配置
    前端插件网址
    Nginx高级玩法
  • 原文地址:https://www.cnblogs.com/developer-wang/p/4520368.html
Copyright © 2011-2022 走看看