zoukankan      html  css  js  c++  java
  • UI<06>

    //声明对象
    @property (nonatomic,strong) UISwitch *switchX;
     
        self.switchX = [[UISwitchalloc] init];
        self.switchX.frame = CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/2,51, 31);
        //用于打开开关外观的颜色
        self.switchX.onTintColor = [UIColor greenColor];
        //用于在开关关闭时调整开关轮廓的颜色
        self.switchX.tintColor = [UIColor purpleColor];
        //thumb外观颜色
        self.switchX.thumbTintColor = [UIColor blueColor];
        //设置初始为ON
        [self.switchX  setOn:YES animated:YES];
       
        //添加事件
        [self.switchX addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventValueChanged];
        [self.view addSubview:self.switchX];
     
     
    //方法的实现
    - (void)switchAction:(UISwitch *)click{
       
         NSLog(@"%@", click.isOn ? @"开..." : @"关...");
     
    }
  • 相关阅读:
    循环神经网络(Recurrent Neural Network)
    特征选择
    程序猿能挣多少钱
    python socket
    python 2 encode and decode
    pandas series
    source collection list
    pep8摘要
    python 正则表达式
    django显示图片
  • 原文地址:https://www.cnblogs.com/iQingYang/p/6688916.html
Copyright © 2011-2022 走看看