Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/94.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 当变量达到某个值时,UIAlertController不显示_Ios_Uitableview_Swift_Var_Uialertcontroller - Fatal编程技术网

Ios 当变量达到某个值时,UIAlertController不显示

Ios 当变量达到某个值时,UIAlertController不显示,ios,uitableview,swift,var,uialertcontroller,Ios,Uitableview,Swift,Var,Uialertcontroller,我想得到一个警报,显示何时达到3个特定值 这是我的密码 func SectionAlert () { if (section1score >= 10){ let alertController: UIAlertController = UIAlertController(title: "Alert", message: "\((section1score as NSNumber).stringValue)", preferredStyle: .Alert)

我想得到一个警报,显示何时达到3个特定值

这是我的密码

func SectionAlert () {

    if (section1score >= 10){

        let alertController: UIAlertController = UIAlertController(title: "Alert", message: "\((section1score as NSNumber).stringValue)", preferredStyle: .Alert)

        let OKAction = UIAlertAction(title: "OK", style: .Default) {
            action -> Void in
        }
        alertController.addAction(OKAction)

        self.presentViewController(alertController, animated: true, completion: nil)

    } else if (section2score >= 10){

    } else if (section3score >= 10){

    }

}
在TableView中点击单元格时,我的应用程序会更新每个节的值

我的代码没有显示任何错误,但当我的值达到或超过10时,它不会向我发出警报

有什么想法吗


谢谢

当一个单元格被点击时,你会调用这个函数吗?不会,但我想如果它取决于单元格的值,那么点击时我的函数会修改我的var值。它应该自己运行吗?我错了吗?