Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.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 无法将类型为“(?)->Void?”的值转换为预期的参数类型“(()->Void)?”_Ios_Swift_Uicollectionview - Fatal编程技术网

Ios 无法将类型为“(?)->Void?”的值转换为预期的参数类型“(()->Void)?”

Ios 无法将类型为“(?)->Void?”的值转换为预期的参数类型“(()->Void)?”,ios,swift,uicollectionview,Ios,Swift,Uicollectionview,无法将类型“->Void?”的值转换为预期的参数类型“->Void” [![在此处输入图像描述][1][1] [1] :`func取消选择单元格{ 如果let start=startDateIndexPath{ var section=start.section var item=start.item+1 if let cell = collectionView?.cellForItem(at: start) as? AirbnbDatePickerCell {

无法将类型“->Void?”的值转换为预期的参数类型“->Void”

[![在此处输入图像描述][1][1]

[1] :`func取消选择单元格{ 如果let start=startDateIndexPath{ var section=start.section var item=start.item+1

        if let cell = collectionView?.cellForItem(at: start) as? AirbnbDatePickerCell {
            cell.type.remove([.InBetweenDate, .SelectedStartDate, .SelectedEndDate, .Selected])
            cell.configureCell()
            collectionView?.deselectItem(at: start, animated: false)
        }

        if let end = endDateIndexPath {
            var indexPathArr = [IndexPath]()
            while section < months.count, section <= end.section {
                let curIndexPath = IndexPath(item: item, section: section)
                if let cell = collectionView?.cellForItem(at: curIndexPath) as? AirbnbDatePickerCell {
                    cell.type.remove([.InBetweenDate, .SelectedStartDate, .SelectedEndDate, .Selected])
                    cell.configureCell()
                    collectionView?.deselectItem(at: curIndexPath, animated: false)
                }

                if section == end.section && item >= end.item {
                    // stop iterating beyond end date
                    break
                } else if item >= (collectionView!.numberOfItems(inSection: section) - 1) {
                    // more than num of days in the month
                    section += 1
                    item = 0
                } else {
                    item += 1
                }
            }

            collectionView?.performBatchUpdates({
                (s) in
                self.collectionView?.reloadItems(at: indexPathArr)
            }, completion: nil)
        }
    }
}`

错误会告诉您解决方案。performBatchUpdates接受回调而不带参数,但您在其中定义了一个参数


删除performBatchUpdates第40行中带有s的行,该行声明回调的参数。

删除s in?如果可能,粘贴代码而不是使用屏幕截图,可以让人更轻松地测试您的示例,谢谢!当隐藏该行时,我遇到另一个问题,我粘贴的日历之间不显示月份e代码让我有解决方案吗?