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

  • 相关阅读:
    Core Text 实现富文本显示
    音视频直播服务平台总结
    WWDC2017那些事
    Swift网络请求(Moya篇)
    [转贴]孙正耀退休感言
    不要让专业限制了你的高度
    你会搞科研吗?
    上传服务端
    AysnTask+HttpClient实现上传
    TextView改变颜色
  • 原文地址:https://www.cnblogs.com/Bo-tree/p/5161327.html
Copyright © 2011-2022 走看看