Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/27.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
复选框未在swift中单独工作。我怎样才能把它分开?_Swift_Xcode_Checkbox - Fatal编程技术网

复选框未在swift中单独工作。我怎样才能把它分开?

复选框未在swift中单独工作。我怎样才能把它分开?,swift,xcode,checkbox,Swift,Xcode,Checkbox,我对swift中的复选框有问题。我使用在github中找到的M13Checkbox。在我的应用程序中,当我单击索引0单元格的复选框时,所有偶数(索引)单元格复选框都已选中。当我点击索引1单元格的复选框时,所有奇数(索引)单元格的复选框都会被选中。我找不到任何理由有人能帮我吗 这是我的代码: func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

我对swift中的复选框有问题。我使用在github中找到的M13Checkbox。在我的应用程序中,当我单击索引0单元格的复选框时,所有偶数(索引)单元格复选框都已选中。当我点击索引1单元格的复选框时,所有奇数(索引)单元格的复选框都会被选中。我找不到任何理由有人能帮我吗

这是我的代码:

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: sipCellId, for: indexPath) as! sipCell


    var searched: String?
    if isSearching {
        searched = filteredArray[indexPath.row]
    }else{
        searched = self.orderId[indexPath.row]
    }


    cell.orderIdLabel.text = searched

    //cell.orderIdLabel.text = self.orderId[indexPath.row]
    cell.detailLabel.text =  self.newDatas[indexPath.row]
    cell.alindiLabel.text = "Alındı: "
    cell.temizlemedeLabel.text = "Temizlemede: "
    cell.teslimEdildiLabel.text = "Teslim edildi: "
    cell.kapidaOdemeLabel.text = "Kapıdan alınacak tutar: \(self.ucret[indexPath.row])"

    cell.deleteButton.tag = indexPath.row
    cell.urunEklemeButton.tag = indexPath.row

    cell.uncheckedButtonAlindi.tag = indexPath.row
    cell.uncheckedButtonTemizleme.tag = indexPath.row
    cell.uncheckedButtonTeslim.tag = indexPath.row


    return cell

}
下面是我的复选框功能:

@objc func checkControlAlindi(sender : M13Checkbox?) {

    switch sender!.checkState {
        case .checked:
            let indexPath = IndexPath(row: (sender!.tag), section: 0)
            let cell = tableView.cellForRow(at: indexPath) as! sipCell
            print(cell.orderIdLabel.text!)
            print("alındı kısmına bastınız... ", (sender!.tag))

        break

        case .unchecked:
             print("unchecked")

        break

        case .mixed:
            //empty...
        break
    }





}
这是我的复选框:

let uncheckedButtonAlindi: M13Checkbox = {
    let button = M13Checkbox()
    button.tintColor = .orange
    button.boxType = .circle

    button.secondaryTintColor = .lightGray
    button.boxLineWidth = 4
    button.checkmarkLineWidth = 3
    button.addTarget(self, action: #selector(ViewController.checkControlAlindi(sender:)), for: UIControl.Event.valueChanged)
    return button
}()

您在单元格中的何处添加此按钮?共享您的sipCell类please@jawadAlisipCell是自定义单元格,按钮放在这里。您有teamviewer吗?