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

  • 相关阅读:
    .NET牛人应该知道些什么
    秋梦
    感谢你走进我的生命里
    漂流有感
    QQ在跳舞
    青春无痕
    名人只是传说,你我才是传奇
    祝福紫秋
    可以用在任何人身上:百战百胜人生10大成功秘诀
    c#发送邮件
  • 原文地址:https://www.cnblogs.com/Bo-tree/p/5161327.html
Copyright © 2011-2022 走看看