zoukankan      html  css  js  c++  java
  • UISwitch 监听响应


        UISwitch *swh = [[UISwitch alloc]initWithFrame:CGRectMake(100,100, 50, 30)];
            swh.on = YES;
            [swh addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventValueChanged];
            cell.accessoryView = swh;
            cell.textLabel.text = tableArr[indexPath.section];

    //switch事件方法
    -(void)switchAction:(id)sender
    {
        UISwitch *switchButton = (UISwitch*)sender;
        BOOL btnSwh = [switchButton isOn];

        if (btnSwh) {
            UIAlertController * alertController = [UIAlertController alertControllerWithTitle: @"提示"
                                                                                      message: @"省流量模式已开启"
                                                                               preferredStyle:UIAlertControllerStyleAlert];
            
            [alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]];
            [self presentViewController:alertController animated:YES completion:nil];
        }
    }

  • 相关阅读:
    linux超级终端minicom的使用方法
    linux常用命令
    chmod 777 修改权限
    linux mount挂载设备(u盘,光盘,iso等 )使用说明
    logcat的调试 比较有用的几个命令
    git分支
    Debug和Release区别
    【Linux】linux常用基本命令
    Git代码仓库的建立流程
    Linux记录-JMX监控Tomcat上传到falcon
  • 原文地址:https://www.cnblogs.com/Bo-tree/p/5161327.html
Copyright © 2011-2022 走看看