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];
        }
    }

  • 相关阅读:
    springboot缓存-Ehcache
    springboot+spring data jpa 多数据源配置
    vue+element 上传图片控件
    springboot下载文件
    easyPoi导入带图片的excel
    内外网同时使用(宽带内网无线内网)
    mysql 8.0 安装
    搭建一个Vue前端项目
    mybatis反向代理自动生成mapper文件
    【1】idea Live Templates
  • 原文地址:https://www.cnblogs.com/Bo-tree/p/5161327.html
Copyright © 2011-2022 走看看